Grapical View Double Linked Lists
description
Transcript of Grapical View Double Linked Lists
![Page 1: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/1.jpg)
1
![Page 2: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/2.jpg)
Nodes &HeaderNodes
Doubly Linked List
2
![Page 3: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/3.jpg)
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
![Page 4: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/4.jpg)
Avail PoolDoubly Linked List
4
![Page 5: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/5.jpg)
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
![Page 6: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/6.jpg)
PushDoubly Linked List
Push Places Nodes At The Front Of The Linked List
2 Cases
6
![Page 7: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/7.jpg)
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
![Page 8: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/8.jpg)
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
![Page 9: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/9.jpg)
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
![Page 10: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/10.jpg)
PopDoubly Linked List
Pop Deletes From The Front Of The Linked List
2 Cases
10
![Page 11: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/11.jpg)
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
![Page 12: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/12.jpg)
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
![Page 13: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/13.jpg)
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
![Page 14: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/14.jpg)
InsertDoubly Linked List
Insert Places Nodes At The Rear Of The Linked List
2 Cases
14
![Page 15: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/15.jpg)
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
![Page 16: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/16.jpg)
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
![Page 17: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/17.jpg)
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
![Page 18: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/18.jpg)
RemoveDoubly Linked List
Remove Deletes From The Front Of The Linked List
2 Cases
18
![Page 19: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/19.jpg)
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
![Page 20: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/20.jpg)
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
![Page 21: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/21.jpg)
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
![Page 22: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/22.jpg)
InsertAfterDoubly Linked List
InsertAfter Places Nodes To The Right Of The Right-Brother
2 Cases
22
![Page 23: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/23.jpg)
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
![Page 24: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/24.jpg)
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
![Page 25: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/25.jpg)
InplaceDoubly Linked List
Inplace Places Nodes Inplace According To The Primary Object Overload
4 Cases
25
![Page 26: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/26.jpg)
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
![Page 27: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/27.jpg)
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
![Page 28: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/28.jpg)
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
![Page 29: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/29.jpg)
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
![Page 30: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/30.jpg)
Nodes & HeaderNodes
![Page 31: Grapical View Double Linked Lists](https://reader036.fdocuments.net/reader036/viewer/2022081505/56816674550346895dda0ddf/html5/thumbnails/31.jpg)
Nodes & HeaderNodes