class SinglyLinkedList
Public Instance Methods
remove_back()
click to toggle source
# File lib/honey_mushroom/singly_linked_list.rb, line 5 def remove_back current = @head current = current.next until current.next.next.nil? node = current.next current.next = nil return node end
to_s()
click to toggle source
# File lib/honey_mushroom/singly_linked_list.rb, line 14 def to_s s = '@head->' current = @head until current.nil? s += "[#{current.value}]->" current = current.next end return s end