Giter Site home page Giter Site logo

sorted_array's Introduction

The SortedArray Lab

In this lab you will build a SortedArray class. Each instance of SortedArray will hold an array, and when you add elements to a SortedArray, they will automatically be placed into the internal array in sorted order.

We are providing a template (sorted_array_template.rb) which has stubs of methods you need (make more if it makes sense or if you want to), and a spec (sorted_array_spec.rb) which will help you get everything working. You can add tests to the spec, but don't delete any.

You can run the spec with rspec <spec_file_name>.

When you first run the spec, there will be a lot of errors and a lot of red. Don't be alarmed. Implement the methods one at a time. Commit often and plan each method before starting it.

I suggest you implement the methods in this order:

  1. SortedArray#[] will be short. Come back to it if you don't get it.
  2. SortedArray#first_larger_index
  3. SortedArray#add
  4. SortedArray#initialize
  5. SortedArray#index

initialize will use add, which will use first_larger_index.

Submit your lab through the lab submission form. Have fun!

sorted_array's People

Contributors

rsofaer avatar amyweiner avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.