Title: One implementation of the LIST ADT
1One implementation of the LIST ADT
head
current
Insert new node before current and new node
becomes current (assume new node created) node
newNode new node
2One implementation of the LIST ADT
head
current
prev
prev head while (prev-gtnext ! current) prev
prev-gtnext
3One implementation of the LIST ADT
head
current
prev
prev head while (prev-gtnext ! current) prev
prev-gtnext
4One implementation of the LIST ADT
head
current
prev
newNode
node newNode new node prev-gtnext newNode
5One implementation of the LIST ADT
head
current
prev
newNode
node newNode new node prev-gtnext
newNode newNode-gtnext current
6One implementation of the LIST ADT
head
prev
current
newNode
node newNode new node prev-gtnext
newNode newNode-gtnext current current
newNode
7One more implementation of the LIST ADT
Circular single linked list
tail
Start function. current tail-gtlink
8One more implementation of the LIST ADT
Doubly linked list
head
current
Insert new node before current and new node
becomes current (assume new node created) node
newNode new node
9One more implementation of the LIST ADT
Doubly linked list
head
current
newNode
newNode-gtprevcurrent-gtprev
10One more implementation of the LIST ADT
Doubly linked list
head
current
newNode
newNode-gtprevcurrent-gtprev newNode-gtnextcurrent
11One more implementation of the LIST ADT
Doubly linked list
head
current
newNode
newNode-gtprevcurrent-gtprev newNode-gtnextcurrent
newNode-gtprev-gtnext newNode
12One more implementation of the LIST ADT
Doubly linked list
head
current
newNode
newNode-gtprevcurrent-gtprev newNode-gtnextcurrent
newNode-gtprev-gtnext newNode current-gtprev
newNode
13One more implementation of the LIST ADT
Doubly linked list
head
current
newNode
newNode-gtprevcurrent-gtprev newNode-gtnextcurrent
newNode-gtprev-gtnext newNode current-gtprev
newNode current newNode