Jump to content

Doubly-linked list/Traversal: Difference between revisions

Line 48:
 
# --- PREPEND - Adds a node to the beginning of the list ---#
PRIO PREPEND = 1; #/* Declares the priority of the operation */#
OP PREPEND = (REF LIST list, DATA data) VOID:
(
HEAP NODE n := (data, NIL, NIL); # Creates new node on heap #
IF head OF list IS REF NODE(NIL) THEN
head OF list := tail OF list := n
Line 99:
(
head OF list := tail OF list := NIL
#/* sets the refs to NIL, allowing the heap to take back the
memory */#
);
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.