29.6 Exercises
Factual
How many inversions are there in the array
[10, 100, 60, 40, 50]
?What is the space complexity of selection sort?
Procedural
Draw the process of heapsort on the array
[5, 9, 2]
, starting with the heapified array and removing the maximum each time.If we are insertion sorting
[5, 6, 7, 1, 8, 9, 2]
, how many total swaps will occur?
Metacognitive
Which sort do you expect to run more quickly on a reversed array, selection sort or insertion sort?
Last updated