Giter Site home page Giter Site logo

linked-list-1's Introduction

Linked List #1

Solution and Tests to the Columbia University Linked List #1 problem.

Project structure

  • lib/linked_list.rb - contains solution
  • spec/linked_list_spec.rb - includes tests for pop, push and reverse_list methods

Solution

  • The Stack class contains implemented methods such as pop, reverse_list
  • The pop method takes the last added element in the stack and returns stack without it
  • The reverse_list method takes stack as a parameter, creates a new stack and iterates through the stack accepted as a parameter. Each element will be added in a new stack and returned as a result
  • The stack_to_array created as an additional method for testing purpose. When test validates two stacks they have different objects inside although the values are the same. For validation purpose of two stacks, I convert stack to array and array to string. That way rspec is able to compare two strings and tests are more readable for other people to review.

Test execution

  • Run bundle install
  • Open terminal window
  • From the project directory run rspec

linked-list-1's People

Contributors

vadim-geroim avatar qatutor avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

qatutor

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.