資料結構›Ch7 搜尋與排序第 6 題/共 76 題
6. Min Heap、Max Heap、Heap建構
#DS-07-006中Min HeapMax HeapHeap建構
a. Draw the binary min heap that emerges from sequentially inserting the elements 11, 9, 12, 14, 3, 15, 7, 8, 1 into an initially empty binary heap. Illustrate the intermediate results as you insert each element, and provide the array representation of the final heap.
b. Write a pseudocode function that transforms a min heap (stored in an array) to a max heap. Store the result in the same array. No return values are expected. Please justify the correctness of your function.
📄 台大113
▤完整推導請見《WH 資工筆記 · 資料結構》Ch7 搜尋與排序