1
Feb 24, 2016
1
Nodes &HeaderNodes
Doubly Linked List
2
Graphical Representation Of HeadersDA_DLList <PartListHeader, Part>
Inventory ( "Inventory.hf", "Inventory.nf", 3, 4);
DLList <PartListHeader, Part> Inventory (3, 4);
1
/ /0
2
/ /0
/ /0
3
1 2 3 4
3
Avail PoolDoubly Linked List
4
Graphical Representation Of Nodes & HeadersDA_DLList <PartListHeader, Part>
Inventory ( "Inventory.hf", "Inventory.nf", 3, 4);
DLList <PartListHeader, Part> Inventory (3, 4);
1 2 3 4
1
5
PushDoubly Linked List
Push Places Nodes At The Front Of The Linked List
2 Cases
6
if (Inventory.Push (3, D))puts (“Successful Push”);
elseputs (“Unsuccessful Push”);
/ /0
3 3 1 2
3 31
3
3
1 2
D
Push To An Empty List7
if (Inventory.Push (3, R))puts (“Successful Push”);
elseputs (“Unsuccessful Push”);
3 31
3
31 2
D
First Push To A Non-Empty List
1 32
3
1R
3D 3 1
2
8
if (Inventory.Push (3, A))puts (“Successful Push”);
elseputs (“Unsuccessful Push”);
Second Push To A Non-Empty List
1 32
3
1R
3D 3 1
2
1R
3D 3
1 32
3
1
/
2 33
3
2A R 1 2 1 3
9
PopDoubly Linked List
Pop Deletes From The Front Of The Linked List
2 Cases
10
if (Inventory.Pop (3, Temp))cout << Temp << endl;
elseputs (“Unsuccessful Pop”);
First Pop From A Non-Empty List
1R
3D 3
1 32
3
1
/
2 33
3
2A R 1 2 1 3
Temp = Old Info = A1 32
3
1R
3D 3 1
2A
11
if (Inventory.Pop (3, Temp))cout << Temp << endl;
elseputs (“Unsuccessful Pop”);
Second Pop From A Non-Empty List
1 32
3
1R
3D 3 1
2
A
Temp = OldInfo = R3 31
3
31 2
D R A
12
if (Inventory.Pop (3, Temp))cout << Temp << endl;
elseputs (“Unsuccessful Pop”);
3 31
3
3
1 2
D
Pop The Last Node From A List
Temp = Old Info = D
AR
/ /0
3 3 1 2ARD
13
InsertDoubly Linked List
Insert Places Nodes At The Rear Of The Linked List
2 Cases
14
if (Inventory.Insert (3, D))puts (“Successful Insert”);
elseputs (“Unsuccessful Insert”);
/ /0
3 3 1 2
3 31
3
3
1 2
D
Insert To An Empty List15
if (Inventory.Insert (3, R))puts (“Successful Insert”);
elseputs (“Unsuccessful Insert”);
3 31
3
31 2
D
First Insert To A Non-Empty List
3 12
3
3D
1R 1 3
2
16
if (Inventory.Insert (3, A))puts (“Successful Insert”);
elseputs (“Unsuccessful Insert”);
Second Insert To A Non-Empty List
3 12
3
3D
1R 1 3
2
1R
2A 3
1 32
3
1
/
3 23
3
3D R 1 3 1 2
17
RemoveDoubly Linked List
Remove Deletes From The Front Of The Linked List
2 Cases
18
if (Inventory.Remove (3, Temp))cout << Temp << endl;
elseputs (“Unsuccessful Remove”);
First Remove From A Non-Empty List
1R
2A 3
1 32
3
1
/
3 23
3
3D R 1 3 1 2
1 22
3
1 2A 2 1
3D
R
Temp = Old Info = D
19
if (Inventory.Remove (3, Temp))cout << Temp << endl;
elseputs (“Unsuccessful Remove”);
Second Remove From A Non-Empty List
Temp = OldInfo = R2 21
3
21 3
A R D
1 22
3
1 2A 2 1
3D
R
20
if (Inventory.Remove (3, Temp))cout << Temp << endl;
elseputs (“Unsuccessful Remove”);
2 21
3
2
1 3
A
Remove The Last Node From A List
Temp = Old Info = A
DR
/ /0
3 2 1 3DRA
21
InsertAfterDoubly Linked List
InsertAfter Places Nodes To The Right Of The Right-Brother
2 Cases
22
if (Inventory.InsertAfter (3, T, 4))puts (“Successful InsertAfter”);
elseputs (“Unsuccessful InsertAfter”);
InsertAfter To The Middle Of A List
1
1R
3Y 3
1 32
3
42 33
3
2C R 4 2 4 3
1R
3Y 3
1 32
3
42 34
3
2C R 4 2 11
/
1T4 3
23
if (Inventory.InsertAfter (3, Z, 4))puts (“Successful InsertAfter”);
elseputs (“Unsuccessful InsertAfter”);
InsertAfter To The End Of A List
1
1R
3Y 3
1 32
3
42 33
3
2C R 4 2 4 3
1R
1Z 3
1 32
3
42 14
3
2C R 4 2 31
/
3Y4 1
24
InplaceDoubly Linked List
Inplace Places Nodes Inplace According To The Primary Object Overload
4 Cases
25
if (Inventory.Inplace (3, D))puts (“Successful Inplace”);
elseputs (“Unsuccessful Inplace”);
/ /0
3 3 1 2
Inplace On An Empty List
Insert
Push
4
3 31
3
3
D
1 24
26
if (Inventory.Inplace (3, A))puts (“Successful Inplace”);
elseputs (“Unsuccessful Inplace”);
3 31
3
3
D
Inplace To Front Of A List
Push
1 24
4 32
3
4A
3D 3 4
1 2
27
if (Inventory.Inplace (3, H))puts (“Successful Inplace”);
elseputs (“Unsuccessful Inplace”);
Inplace To The End Of A List
4 32
3
4A
3D 3 4
1 2
1R
1H 3
1 32
3
34 13
3
4A D 3 4 3 1
2
Insert
28
if (Inventory.Inplace (3, F))puts (“Successful Inplace”);
elseputs (“Unsuccessful Inplace”);
Inplace To The Middle Of A List
1R
1H 3
1 32
3
34 13
3
4A D 1 4 3 1
2
1R
1H 3
1 32
3
34 14
3
4A D 3 4 22
/
2F3 1
InsertAfter
29
Nodes & HeaderNodes
Nodes & HeaderNodes