MATLAB Object-Oriented Programming

(Joyce) #1

head.Next.Next


ans =


dlnode with properties:


Data: 4
Next: [1x1 dlnode]
Prev: [1x1 dlnode]


And the previous node has a Data value of 2 :


head.Next


ans =


dlnode with properties:


Data: 2
Next: [1x1 dlnode]
Prev: [1x1 dlnode]


Delete a Node


To delete a node, call the removeNode method on that node. The removeNode method
disconnects the node and reconnects the list before allowing MATLAB to destroy the
removed node. MATLAB destroys the node once references to it by other nodes are
removed and the list is reconnected.


Implementing Linked Lists with Classes
Free download pdf