Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 337 Bytes

readme.md

File metadata and controls

23 lines (16 loc) · 337 Bytes

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]