Class: DataStructList::SimpleLinkedList
- Defined in:
- lib/data_struct_list.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Stack
Instance Method Summary collapse
Methods inherited from Stack
Constructor Details
This class inherits a constructor from DataStructList::Stack
Instance Method Details
#remove(id) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/data_struct_list.rb', line 86 def remove(id) elm = @first aux = @first until elm == nil if elm.id == id then break end aux = elm elm = elm.next end if elm!=nil then aux.next = elm.next @head.quant -= 1 if elm == @head.next @first = elm.next @head.next = @first end if @last == elm then @last = aux end elm = nil end end |