Linked Lists Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 17...

Post on 21-Jan-2016

221 views 0 download

Transcript of Linked Lists Data Structures & Problem Solving Using JAVA Second Edition Mark Allen Weiss Chapter 17...

Linked Lists

Data Structures & Problem SolvingUsing JAVASecond Edition

Mark Allen Weiss

Chapter 17

© 2002 Addison Wesley

Figure 17.1Basic linked list

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.2Insertion in a linked list: Create new node (tmp), copy in x , set tmp’s next link, and set current’s next link

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.3Deletion from a linked list

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.4Using a header node for the linked list

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.5Empty list when a header node is used

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.15A doubly linked list

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.16An empty doubly linked list

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.17Insertion in a doubly linked list by getting new node and then changing pointers in the order indicated

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.18A circularly and doubly linked list

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.31 (A)Commands for editor in Exercise 17.19 (continued)

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley

Figure 17.31 (B)Commands for editor in Exercise 17.19 (continued)

Data Structures & Problem Solving using JAVA/2E Mark Allen Weiss © 2002 Addison Wesley