Doubly Linked Lists1 © 2014 Goodrich, Tamassia, Goldwasser Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014
Doubly Linked Lists2 Doubly Linked List A doubly linked list can be traversed forward and backward Nodes store: element link to the previous node link to the next node Special trailer and header nodes prevnext element trailer header nodes/positions elements node © 2014 Goodrich, Tamassia, Goldwasser
Doubly Linked Lists3 Insertion Insert a new node, q, between p and its successor. ABXC ABC p ABC p X q pq © 2014 Goodrich, Tamassia, Goldwasser
Doubly Linked Lists4 Deletion Remove a node, p, from a doubly linked list. ABCD p ABC D p ABC © 2014 Goodrich, Tamassia, Goldwasser
Doubly-Linked List in Java © 2014 Goodrich, Tamassia, GoldwasserDoubly Linked Lists5
Doubly-Linked List in Java, 2 © 2014 Goodrich, Tamassia, GoldwasserDoubly Linked Lists6
Doubly-Linked List in Java, 3 © 2014 Goodrich, Tamassia, GoldwasserDoubly Linked Lists7
Doubly-Linked List in Java, 4 © 2014 Goodrich, Tamassia, GoldwasserDoubly Linked Lists8