Implementation of a linked list in Ruby.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
linked_list.rb
readme.md
test.rb

readme.md

Linked List

This is my implementation of a linked list in Ruby.

Quick Example

require './linked_list'

list = List.new(1, 2, 3)
p list.to_a #=> [1, 2, 3]

list.push(4) 
p list.to_a #=> [1, 2, 3, 4]

list.pop
p list.to_a #=> [1, 2, 3]

list.unshift(0)
p list.to_a #=> [0, 1, 2, 3]

list.shift
p list.to_a #=> [1, 2, 3]