Java Reference
In-Depth Information
Input
Memory
Output
12
16
19
31
12
25
21
56
40
16
19
31
29
16
25
21
56
40
29
19
31
25
21
56
40
19
14
19
21
31
25
29
56
40
40
21
31
25
29
56
14
21
25
31
35
21
40
29
56
14
Figure8.8 Replacement selection example. After building the heap, root
value 12 is output and incoming value 16 replaces it. Value 16 is output next,
replaced with incoming value 29. The heap is reordered, with 19 rising to the
root. Value 19 is output next. Incoming value 14 is too small for this run and
is placed at end of the array, moving value 40 to the root. Reordering the heap
results in 21 rising to the root, which is output next.
Search WWH ::




Custom Search