Download presentation
Presentation is loading. Please wait.
Published byPhillip Martin Modified over 9 years ago
1
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 JAVA: Walls and Mirrors Carrano / Prichard Algorithm Efficiency and Sorting
2
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.1 Time requirements as a function of the problem size n
3
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.2 When n ≥ 2, 3 * n 2 exceeds n 2 - 3 * n + 10
4
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.3a A comparison of growth-rate functions: a) in tabular form
5
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.3b A comparison of growth-rate functions: b) in graphical form
6
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.4 A selection sort of an array of five integers
7
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.5 The first two passes of a bubble sort of an array of five integers: a) pass 1; b) pass 2
8
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.6 An insertion sort partitions the array into two regions
9
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.7 An insertion sort of an array of five integers.
10
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.8 A mergesort with an auxiliary temporary array
11
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.9 A mergesort of an array of six integers
12
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.10 A worst-case instance of the merge step in mergesort
13
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.11 Levels of recursive calls to mergesort given an array of eight items
14
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.12 A partition about a pivot
15
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.13 kSmall versus quicksort
16
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.14 Invariant for the partition algorithm
17
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.15 Initial state of the array
18
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.16 Moving theArray[firstUnknown] into S 1 by swapping it with theArray[lastS1+1] and by incrementing both lastS1 and firstUnknown
19
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.17 Moving theArray[firstUnknown] into S 2 by incrementing firstUnknown
20
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.18a Developing the first partition of an array when the pivot is the first item
21
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.18b Developing the first partition of an array when the pivot is the first item
22
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.19 A worst-case partitioning with quicksort
23
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.20 A average-case partitioning with quicksort
24
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.21 A radix sort of eight integers
25
Data Abstraction and Problem Solving with JAVA Walls and Mirrors; Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Figure 9.22 Approximate growth rates of time required for eight sorting algorithms
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.