Chapter 6 Flashcards Preview

Algorithm > Chapter 6 > Flashcards

Flashcards in Chapter 6 Deck (14)
Loading flashcards...
1

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

3

4

5

6

7

8

9

10

11

12

13

14