資料結構›Ch7 搜尋與排序第 33 題/共 76 題
33. Min Heap、Insert、Percolate Up
#DS-07-033中Min HeapInsertPercolate Up
(3%) Considering the following implementation of min heap, which way of filling in the code to make function insert work correctly?
#define MAX_SIZE 10
int data[MAX_SIZE];
int size=0;
void insert(int x)
{
if (size>=MAX_SIZE-1) return;
int cur= □□ ;
while(cur!=0 && data[◇◇]>x) {
data[cur]=data[◇◇];
cur= ◇◇;
}
data[cur]=x;
}
📄 交大114
▤完整推導請見《WH 資工筆記 · 資料結構》Ch7 搜尋與排序