22
Data Abstraction and Problem Solving with JAVA Walls and Mirrors Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Data Abstraction and Problem Solving with Data Abstraction and Problem Solving with JAVA: Walls and Mirrors JAVA: Walls and Mirrors Carrano / Prichard Carrano / Prichard Tables and Priority Tables and Priority Queues Queues

Figure 11.1 An ordinary table of cities

Embed Size (px)

DESCRIPTION

Figure 11.1 An ordinary table of cities. Figure 11.2 The data fields for two sorted linear implementations of the ADT table for the data in Figure 11.1: a) array based; b) reference based. Figure 11.3 - PowerPoint PPT Presentation

Citation preview

Page 1: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and MirrorsFrank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Data Abstraction and Problem Solving with JAVA: Data Abstraction and Problem Solving with JAVA: Walls and MirrorsWalls and Mirrors

Carrano / PrichardCarrano / Prichard

Tables and Priority QueuesTables and Priority Queues

Page 2: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.1Figure 11.1An ordinary table of cities

Page 3: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.2Figure 11.2The data fields for two sorted linear implementations of the ADT table for the data in Figure 11.1: a) array based; b) reference based

Page 4: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.3Figure 11.3The data fields for a binary search tree implementation of the ADT table for the data in Figure 11.1

Page 5: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.4Figure 11.4Insertion for unsorted linear implementations: a) array based; b) reference based

Page 6: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.5Figure 11.5Insertion for sorted linear implementations: a) array based; b) reference based

Page 7: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.6Figure 11.6The average-case order of the operations of the ADT table for various implementations

Page 8: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.7a and 11.7bFigure 11.7a and 11.7bSome implementations of the ADT priority queue: a) array based; b) reference based

Page 9: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.7cFigure 11.7cSome implementations of the ADT priority queue: c) binary search tree

Page 10: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.8Figure 11.8A heap with its array representation

Page 11: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.9aFigure 11.9aa) Disjoint heaps

Page 12: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.9bFigure 11.9bb) a semiheap

Page 13: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.10Figure 11.10Deletion for a heap

Page 14: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.11Figure 11.11Recursive calls to heapRebuild

Page 15: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.12Figure 11.12Insertion into a heap

Page 16: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.13Figure 11.13a) The initial contents of anArray’s corresponding binary tree

Page 17: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.14Figure 11.14Transforming an array anArray into a heap

Page 18: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.15Figure 11.15Heapsort partitions an array into two regions

Page 19: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.16aFigure 11.16aA trace of heapsort, beginning with the heap in Figure 11-14

Page 20: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.16bFigure 11.16bA trace of heapsort, beginning with the heap in Figure 11-14

Page 21: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.16cFigure 11.16cA trace of heapsort, beginning with the heap in Figure 11-14

Page 22: Figure 11.1 An ordinary table of cities

Data Abstraction and Problem Solving with JAVA   Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley

Figure 11.17Figure 11.17Array for Self-Test Exercise 2 and 7 and Exercise 17