Coder Social home page Coder Social logo

linked-list-exercises's Introduction

Linked List Exercises

Exercise 1

With your neighbor look at exercise1.rb and answer the following questions.

  1. Before you run the program, what do you think it does?
  2. Draw the resulting Linked List.
  3. What do you think it prints out, run the application and verify your answer.

Exercise 2

  1. Before you run the program, what do you think is happening with Block 1?
  2. What do you think happens in Block 2?
  3. Draw the resulting Linked List.
  4. What do you think it prints out, run the application and verify your answer.
  5. What would happen if you deleted the line current = current.next_node from line 25?

Exercise 3

  1. Block 1 loops through and creates a list of nodes from 1-8. What does block 2 do?
  2. What will back be referring to at the end? Run the program and verify your prediction.

Exercise 4

The code segment in exercise 4 creates a new list. Try to implement a find method to find if a value is in the list or not.

Exercise 5

Write a method which reverses the original list, it will return a reference to a node which is the head of the reversed list.

linked-list-exercises's People

Contributors

cheezitman avatar

Watchers

 avatar  avatar

Forkers

ada-c12

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.