/linked-list

A singly linked list with each node containing integer data. Methods on the singly linked list

Primary LanguageRuby

Linked-List

Using object oriented design constructs, define a Node class and LinkedList class for a singly linked list. Each node has integer data value and a link to the next node. The linked list class has a head node and the following methods defined.

Exercise

Design and implement the classes and the methods. Implement the methods within the Linked List class that are currently raising NotImplementedError.

Going Further

Create a new class called DoublyLinkedList which implements a doubly linked list. Then implement the following methods:

  • add_first
  • add_last
  • get_first
  • get_at_index(index)
  • reverse
  • delete(value)

Once you finish writing the method, update the comments to indicate the time & space complexity of your solution.