Lab 14, Task 2 -------------- 1. If we interpret the array as a complete tree, it looks like this: +----+ | 5 | +----+ ____/ \____ / \ +----+ +----+ | 3 | | 12 | +----+ +----+ / \ / \ +----+ +----+ +----+ +----+ | 8 | | 7 | | 4 | | 6 | +----+ +----+ +----+ +----+ 2. To turn the complete tree into a heap, we take the following steps: 1. Sift 12 down. This does not change anything. 2. Sift 3 down. +----+ | 5 | +----+ ____/ \____ / \ +----+ +----+ | 8 | | 12 | +----+ +----+ / \ / \ +----+ +----+ +----+ +----+ | 3 | | 7 | | 4 | | 6 | +----+ +----+ +----+ +----+ 3. Sift 5 down. +----+ | 12 | +----+ ____/ \____ / \ +----+ +----+ | 8 | | 6 | +----+ +----+ / \ / \ +----+ +----+ +----+ +----+ | 3 | | 7 | | 4 | | 5 | +----+ +----+ +----+ +----+ At this point, the array looks like this: {12, 8, 6, 3, 7, 4, 5}