1 / 31

Grapical View Double Linked Lists

Grapical View Double Linked Lists. Dr. Thomas E. Hicks Computer Science Dept Trinity University. 1. Nodes & HeaderNodes Doubly Linked List. DA_DLList < PartListHeader , Part> Inventory ( " Inventory.hf ", "Inventory.nf", 3, 4);. DLList < PartListHeader , Part>

baxter
Download Presentation

Grapical View Double Linked Lists

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Grapical View Double Linked Lists Dr. Thomas E. Hicks Computer Science Dept Trinity University 1

  2. Nodes &HeaderNodes Doubly Linked List

  3. DA_DLList <PartListHeader, Part> Inventory ( "Inventory.hf", "Inventory.nf", 3, 4); DLList <PartListHeader, Part> Inventory (3, 4); Graphical Representation Of Headers 1 0 / / 2 0 / / 3 0 / / 1 2 3 4

  4. Avail Pool Doubly Linked List

  5. DA_DLList <PartListHeader, Part> Inventory ( "Inventory.hf", "Inventory.nf", 3, 4); DLList <PartListHeader, Part> Inventory (3, 4); Graphical Representation Of Nodes & Headers 1 2 3 4 1

  6. 2 Cases PushDoubly Linked List Push Places Nodes At The Front Of The Linked List

  7. Push To An Empty List if (Inventory.Push (3, D)) puts (“Successful Push”);else puts (“Unsuccessful Push”); 3 1 2 3 3 3 1 0 / 3 / 3 D 1 2

  8. First Push To A Non-Empty List if (Inventory.Push (3, R)) puts (“Successful Push”);else puts (“Unsuccessful Push”); 3 1 2 D 3 3 1 3 2 1 1 3 3 3 3 1 R D 2

  9. Second Push To A Non-Empty List if (Inventory.Push (3, A)) puts (“Successful Push”);else puts (“Unsuccessful Push”); 3 3 3 1 3 3 2 2 1 2 1 3 3 3 1 2 1 3 3 1 R D R 3 1 1 3 2 D R A 2 /

  10. 2 Cases Pop Doubly Linked List Pop Deletes From The Front Of The Linked List

  11. First Pop From A Non-Empty List if (Inventory.Pop (3, Temp))cout << Temp << endl;else puts (“Unsuccessful Pop”); Temp = Old Info = A 3 3 3 1 3 2 2 3 1 2 1 3 3 3 1 1 2 3 3 1 R D R 3 1 3 1 2 D A R 2 / A

  12. Second Pop From A Non-Empty List if (Inventory.Pop (3, Temp))cout << Temp << endl;else puts (“Unsuccessful Pop”); A Temp = OldInfo = R 3 3 1 3 2 1 1 3 3 3 3 3 1 R D 1 2 D R A 2

  13. Pop The Last Node From A List if (Inventory.Pop (3, Temp))cout << Temp << endl;else puts (“Unsuccessful Pop”); 3 1 2 R A 3 3 Temp = Old Info = D 3 1 0 / 3 / 3 D D R A 1 2

  14. 2 Cases Insert Doubly Linked List Insert Places Nodes At The Rear Of The Linked List

  15. Insert To An Empty List if (Inventory.Insert (3, D)) puts (“Successful Insert”);else puts (“Unsuccessful Insert”); 3 1 2 3 3 3 1 0 / 3 / 3 D 1 2

  16. First Insert To A Non-Empty List if (Inventory.Insert (3, R)) puts (“Successful Insert”);else puts (“Unsuccessful Insert”); 3 1 2 D 3 3 3 1 2 1 3 3 3 1 1 3 D R 2

  17. Second Insert To A Non-Empty List if (Inventory.Insert (3, A)) puts (“Successful Insert”);else puts (“Unsuccessful Insert”); 3 3 3 3 1 3 2 2 1 3 3 2 3 1 1 3 1 2 1 3 D R R 2 1 1 3 3 A R D 2 /

  18. 2 Cases Remove Doubly Linked List Remove Deletes From The Front Of The Linked List

  19. First Remove From A Non-Empty List if (Inventory.Remove (3, Temp))cout << Temp << endl;else puts (“Unsuccessful Remove”); Temp = Old Info = D 3 3 3 2 2 3 1 3 1 2 2 3 1 1 1 3 2 2 R R 2 1 2 3 1 1 3 A R D A 3 / D

  20. Second Remove From A Non-Empty List if (Inventory.Remove (3, Temp))cout << Temp << endl;else puts (“Unsuccessful Remove”); Temp = OldInfo = R 3 3 1 2 2 1 2 2 1 2 2 R 2 1 A 1 3 A R D 3 D

  21. Remove The Last Node From A List if (Inventory.Remove (3, Temp))cout << Temp << endl;else puts (“Unsuccessful Remove”); 2 1 3 R D 3 3 Temp = Old Info = A 2 1 0 / 2 / 2 A A R D 1 3

  22. 2 Cases InsertAfterDoubly Linked List InsertAfter Places Nodes To The Right Of The Right-Brother

  23. InsertAfter To The Middle Of A List if (Inventory.InsertAfter (3, T, 4)) puts (“Successful InsertAfter”);else puts (“Unsuccessful InsertAfter”); 4 2 1 3 R 3 4 3 4 2 Y C R 1 3 3 3 3 3 2 2 4 2 1 1 2 3 3 3 3 4 1 2 1 3 R 1 T 3 1 Y 4 3 2 4 C R /

  24. InsertAfter To The End Of A List if (Inventory.InsertAfter (3, Z, 4)) puts (“Successful InsertAfter”);else puts (“Unsuccessful InsertAfter”); 4 2 1 3 R 3 4 3 4 2 Y C R 1 3 3 3 3 3 2 2 4 2 1 1 2 3 1 3 3 4 3 2 1 1 R 1 Y 1 3 Z 4 3 2 4 C R /

  25. 4 Cases InplaceDoubly Linked List Inplace Places Nodes Inplace According To The Primary Object Overload

  26. Inplace On An Empty List if (Inventory.Inplace (3, D)) puts (“Successful Inplace”);else puts (“Unsuccessful Inplace”); 4 3 1 2 Insert 3 3 Push 3 1 0 3 / / 3 D 4 1 2

  27. Inplace To Front Of A List if (Inventory.Inplace (3, A)) puts (“Successful Inplace”);else puts (“Unsuccessful Inplace”); 3 4 1 2 D Push 3 3 4 3 1 2 3 4 3 3 3 4 A D 1 2

  28. Inplace To The End Of A List if (Inventory.Inplace (3, H)) puts (“Successful Inplace”);else puts (“Unsuccessful Inplace”); 4 3 3 4 A D 1 2 Insert 3 3 3 2 3 2 1 4 4 3 1 3 3 1 4 1 D 1 3 3 3 4 H R A 2

  29. Inplace To The Middle Of A List if (Inventory.Inplace (3, F)) puts (“Successful Inplace”);else puts (“Unsuccessful Inplace”); 3 1 4 1 D 1 3 3 1 4 H A R 2 InsertAfter 3 3 3 3 3 2 4 2 1 4 4 1 1 3 1 3 3 2 1 4 1 D 2 F 1 2 H 3 3 4 3 R A /

  30. Nodes & HeaderNodes

  31. Nodes & HeaderNodes

More Related