SUNY Oneonta Data Structures and Algorithms Visualization Teaching

  • Slides: 55
Download presentation
SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Heapsort An Auto-generated

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Heapsort An Auto-generated Presentation

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap • A ‘heap’ is a tree wherein each node is of a value equal to or less than its parent. • Additionally, a ‘binary tree’ is used, which adds the constraint that no parent may have more than two nodes; this allows heapsort to run within its own array, without additional space complexity. • Each limb is passed through in reverse order, if the largest child is larger than the parent, they are swapped

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 38 7 8 25 98 94 43 80 12 75 12 33 66 43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 38 98 75 66 7 94 80 12 12 33 66 31 8 25 43 43

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 38 7 8 25 98 94 43 80 12 75 12 33 66 43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 38 98 75 66 7 94 80 12 12 33 66 31 8 25 43 43

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 38 43 8 25 98 94 7 80 12 75 12 33 66 43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 38 98 75 66 43 94 80 12 12 33 66 31 8 25 7 43

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 38 43 8 25 98 94 7 80 12 75 12 33 66 43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 38 98 75 66 43 94 80 12 12 33 66 31 8 25 7 43

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 38 43 8 25 98 94 7 80 12 75 12 33 66 43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 38 98 75 66 43 94 80 12 12 33 66 31 8 25 7 43

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 38 43 8 25 98 94 7 80 12 75 12 33 66 43 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 38 98 75 66 43 94 80 12 12 33 66 31 8 25 7 43

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 94 43 8 25 98 43 7 80 12 75 12 33 66 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 94 98 75 66 43 43 80 12 12 33 66 31 8 25 7 38

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 43 7 98 66 31 94 43 8 25 98 43 7 80 12 75 12 33 66 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 43 98 94 98 75 66 43 43 80 12 12 33 66 31 8 25 7 38

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 98 7 98 66 31 94 43 8 25 43 43 7 80 12 75 12 33 66 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 98 98 94 43 75 66 43 43 80 12 12 33 66 31 8 25 7 38

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 4 98 98 66 31 7 94 43 8 25 43 43 7 80 12 75 12 33 66 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 98 98 66 94 43 75 31 43 43 80 12 12 33 66 7 8 25 7 38

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group First, heapsort must build a heap 98 98 94 66 31 7 80 43 8 25 43 43 7 4 12 75 12 33 66 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 98 94 98 66 80 43 75 31 43 43 4 12 12 33 66 7 8 25 7 38

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group The finished heap

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group The finished heap 98 98 94 66 31 7 80 43 8 25 43 43 7 4 12 75 12 33 66 38 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 98 94 98 66 80 43 75 31 43 43 4 12 12 33 66 7 8 25 7 38

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array • At this point heapsort functions much like a ‘reverse’ selection sort, only ‘selecting’ is hardly necessary; it knows exactly where the largest values are: at the top of the heap! • The first in the array is swapped with the last unsorted number, and the heap rebuilds itself.

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 38 98 94 66 31 7 80 43 8 25 43 43 4 12 75 12 33 66 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 38 94 98 66 80 43 75 31 43 43 4 12 12 33 66 7 8 25 7 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 98 75 94 66 31 7 80 43 8 25 43 43 4 12 66 12 33 38 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 98 94 75 66 80 43 66 31 43 43 4 12 12 33 38 7 8 25 7 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 75 94 66 31 7 80 43 8 43 43 4 12 66 12 33 38 25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 94 75 66 80 43 66 31 43 43 4 12 12 33 38 7 8 25 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 94 75 80 66 31 7 43 43 8 43 7 4 12 66 12 33 38 25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 94 80 75 66 43 43 66 31 43 7 4 12 12 33 38 7 8 25 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 25 75 80 66 31 7 43 43 43 7 4 12 66 12 33 38 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25 80 75 66 43 43 66 31 43 7 4 12 12 33 38 7 8 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 80 75 66 43 31 7 43 25 43 7 4 12 66 12 33 38 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 80 66 75 43 43 43 66 31 25 7 4 12 12 33 38 7 8 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 8 75 66 43 31 43 25 43 7 4 12 66 12 33 38 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 66 75 43 43 43 66 31 25 7 4 12 12 33 38 7 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 75 66 66 43 31 43 25 43 7 4 12 38 12 33 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 75 66 66 43 43 43 38 31 25 7 4 12 12 33 8 7 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 66 66 43 31 43 25 43 7 4 12 38 12 33 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 66 66 43 43 43 38 31 25 7 4 12 12 33 8 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 66 66 43 31 7 43 25 43 7 4 12 38 12 33 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 66 43 66 31 43 43 38 7 25 7 4 12 12 33 8 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 8 66 43 31 7 43 25 43 7 4 12 38 12 33 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 43 66 31 43 43 38 7 25 7 4 12 12 33 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 66 43 43 31 7 43 25 12 7 4 8 38 12 33 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 66 43 43 31 43 12 38 7 25 7 4 8 12 33 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 33 43 43 31 7 43 25 12 7 4 8 38 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 33 43 43 31 43 12 38 7 25 7 4 8 12 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 43 43 43 31 7 33 25 12 7 4 8 38 12 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 43 43 43 31 33 12 38 7 25 7 4 8 12 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 12 43 43 31 7 33 25 12 7 4 38 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 12 43 43 31 33 12 38 7 25 7 4 8 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 43 43 33 31 7 12 25 12 7 4 38 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 43 33 43 31 12 12 38 7 25 7 4 8 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 8 43 33 31 7 12 25 12 7 38 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 33 43 31 12 12 38 7 25 7 4 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 43 38 33 31 7 12 25 12 7 8 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 43 33 38 31 12 12 8 7 25 7 4 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 4 38 33 31 7 12 25 12 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 33 38 31 12 12 8 7 25 7 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 38 12 33 31 7 12 25 4 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 38 33 12 31 12 4 8 7 25 7 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 12 33 31 7 12 4 8 25 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 33 12 31 12 4 8 7 25 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 33 12 31 25 7 12 4 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 33 31 12 25 12 4 8 7 7 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 12 31 25 12 4 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 31 12 25 12 4 8 7 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 31 12 25 7 12 4 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 31 25 12 7 12 4 8 7 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 12 25 7 12 4 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 25 12 7 12 4 8 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 25 12 12 7 7 4 8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 25 12 12 7 7 4 8 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 8 12 12 7 7 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 12 12 7 7 4 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 12 12 8 7 7 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 12 8 12 7 7 4 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 4 12 8 7 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 8 12 7 7 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 12 4 8 7 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 12 8 4 7 7 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 4 8 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 8 4 7 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 8 4 7 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 8 7 4 7 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 4 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 7 4 8 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 4 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 7 4 8 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 4 7 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 7 8 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 7 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 4 7 8 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Now, heapsort can sort the array 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 7 8 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group The array is

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group The array is now sorted! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 4 7 7 8 12 12 25 31 33 38 43 43 43 66 66 75 80 94 98 98

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Further information… •

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Further information… • Heapsort has similar problem complexity as mergesort, but is often preferred due to its better space complexity. While on most architecture, depending on optimizations, quicksort performs better, heapsort has a much preferable worst case complexity. – Worst case performance Θ(nlog n) – Best case performance Θ(nlog n) – Average case performance Θ(nlog n) – Worst case space complexity Θ(n)

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Purpose and Acknowledgement

SUNY Oneonta Data Structures and Algorithms Visualization Teaching materials Generation Group Purpose and Acknowledgement • This set of slides were automatically generated by a generator piloted by Erik Williams when he worked on a novel computer science homework which was designed to also contribute to an ongoing project conducted at SUNY Oneonta. • This slides are intended to facilitate the teaching effort of Heapsort. Feel free to polish the slides as you like as long as our effort can be properly acknowledged. • For more data structures and algorithms teaching materials, feel free to visit the website of our on-going project. – A Platform for Power. Point Presentation based Teaching Materials of Data Structures and Algorithms • Your comments and spiritual support will be most appreciated. Contact information can be found from the above website.