11.07.2015 Views

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

Data Structures and Algorithm Analysis - Computer Science at ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Sec. 8.5 External Sorting 291Input Memory Output1216 1931 12252156 401629 1931 1625 21 5640291931252156 401914 2131 19252956 4040213125 29 56142135 25 31 2140 29 5614Figure 8.8 Replacement selection example. After building the heap, rootvalue 12 is output <strong>and</strong> incoming value 16 replaces it. Value 16 is output next,replaced with incoming value 29. The heap is reordered, with 19 rising to theroot. Value 19 is output next. Incoming value 14 is too small for this run <strong>and</strong>is placed <strong>at</strong> end of the array, moving value 40 to the root. Reordering the heapresults in 21 rising to the root, which is output next.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!