User:Eriksiers/Linked List: Difference between revisions
fixed a few bugs^H^H^H^H brain farts
(created) |
(fixed a few bugs^H^H^H^H brain farts) |
||
Line 4:
Private Type Node
data As Variant
End Type
Line 58:
listEmpty = False
curNode = 0
nodes(0).
nodes(0).
Else
Dim tmp As Variant
tmp = UBound(nodes) + 1
ReDim Preserve nodes(tmp)
'this If block splices the new node into the list
If Before = where Then
nodes(nodes(curNode).
nodes(tmp).
nodes(tmp).
nodes(curNode).
Else
nodes(nodes(curNode).
nodes(tmp).
nodes(tmp).
nodes(curNode).
End If
curNode = tmp
Line 89:
If UBound(nodes) > 0 Then
'patch the surrounding elements together
nodes(nodes(curNode).
nodes(nodes(curNode).
'select the appropriate
curNode = nodes(curNode).
'finally, the actual delete
ReDim Preserve nodes(UBound(nodes) - 1)
Line 103:
Else
'patch the surrounding elements together
nodes(nodes(curNode).
nodes(nodes(curNode).
'swap with node at end of list
Dim tmp As Node
Line 111:
nodes(curNode) = tmp
'patch the list
nodes(nodes(curNode).
nodes(nodes(curNode).
'select the appropriate
If UBound(nodes) <> nodes(UBound(nodes)).
'finally, the actual delete
ReDim Preserve nodes(UBound(nodes) - 1)
Line 123:
Public Function nextnode() As Boolean
End Function
Public Function prevNode() As Boolean
End Function</lang>
|