Assume you have the max-heap 100, 80, 70, 60, 50, 40, 30, 50, 10, 20. What is the final state of the array after one full iteration of heapsort (stop before the recursive call ono sub arrays, Sorts from min to max values, pivot placed at the end) is called? 80, 60, 70, 50, 50, 40, 30, 30, 20, 10, 100 80, 60, 70, 50, 50, 40, 30, 30, 20, 10 100, 80, 70, 60, 50, 50, 40, 30, 30, 20, 10 100, 80, 60, 70, 50, 50, 40, 30, 30, 20, 10 60, 70, 50, 50, 40, 30, 30, 20, 10, 100, 80
Assume you have the max-heap 100, 80, 70, 60, 50, 40, 30, 50, 10, 20. What is the final state of the array after one full iteration of heapsort (stop before the recursive call ono sub arrays, Sorts from min to max values, pivot placed at the end) is called?
80, 60, 70, 50, 50, 40, 30, 30, 20, 10, 100
80, 60, 70, 50, 50, 40, 30, 30, 20, 10
100, 80, 70, 60, 50, 50, 40, 30, 30, 20, 10
100, 80, 60, 70, 50, 50, 40, 30, 30, 20, 10
60, 70, 50, 50, 40, 30, 30, 20, 10, 100, 80
Assume you have the following array: 8, 5, 30, 15, 100, 10, 20. What will the array look like after a single pass of the Partition part of the quicksort
5, 8, 15, 20, 30, 10
8, 5, 15, 10, 20, 30, 100
8, 5, 15, 10, 20, 100, 30
8, 5, 15, 10, 100, 30, 20
15, 8, 5, 20, 100, 30
Assume you have the array 7,9,6,10,3,5,8, what are the swaps that occur when we call build-min-heap?
6-5, 9-3
9-3, 7-3
6-5, 7-3, 9-3
9-3, 7-3, 6-5
6-5, 9-3, 7-3
Assume we have the array 4,10,3,5,1,2,5,6,1,2,3. What is the final state of the array after the min-heapify is called on node 10?
10 , 6, 5, 5, 4, 3, 3, 2, 2, 1, 1
4, 1, 3, 5, 2, 2,5,6,1,10,3
1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 10
4, 1, 2, 5, 3, 2, 5, 6, 1, 10, 3
4, 1, 3, 5, 10, 2, 5, 6, 1, 2, 3
Step by step
Solved in 2 steps