Chapter 6 Flashcards
1
Q
A
Inside your max_heapify function, you compare the value of the root node (this is the i parameter) with the values of its children. The children are located at indices like 2*i+1, 2*i+2.
So what happens in max_heapify if 2*i+ is outside the bounds of the array?
It won’t swap anything or continue down the tree at all, it’ll likely just be a no-op. So, there’s no difference effectively.
2
Q
A
3
Q
A
4
Q
A
5
Q
A
6
Q
A
7
Q
A
8
Q
A
9
Q
A
10
Q
A
11
Q
A
12
Q
A
13
Q
A
14
Q
A