Linked List
This is linked list implementation both singly and doubly in ruby. Its main purpose is demonstration.
Usage
require "linked_list_sourav"
list = LinkedList::Singly.new(1)
list.head
list.add(2)
3.upto(20) { |data| list.add(data)}
list.find(10)
list.delete(6)
list.add_a([21, 22, 23, 24])
list = LinkedList::Singly.new([1, 2, 3, 4])
list.parse
list.to_a
list.to_s
list.no_of_nodes
list = LinkedList::Doubly.new(1)
list.head
list.add(2)
3.upto(20) { |data| list.add(data)}
list.find(10)
list.delete(6)
list = LinkedList::Doubly.new([1, 2, 3, 4])
list.parse
list.to_a
list.to_s