看板 Grad-ProbAsk 關於我們 聯絡資訊
※ 引述《bernachom (Terry)》之銘言: : 1. For a complete binary tre represented in memory as an array,if there is : a node at index 4i+3 it must be a child of a child (grandchild) of the : node at i. (1) / \ (2) (3) / \ / \ (4) (5) (6) (7) / \ / \ / \ / \ (8) (9)(10)(11) (12)(13)(14)(15) / \ / \ (16)(17)(18)(19) aussume node i is forth, then the children (8) and (9) are 2i and 2i+1, respectively. Also, grandchild (19) is 4i+3. : 2. Searching for a key in a heap takes worst-case time O(n). : 解答寫: 1.T 2.T : 第一題我不太清楚... : 第二題最差的case 不是應該為nlogn才是嗎? : 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.216.9.112
bernachom:謝謝幫忙,我知道了 04/05 14:09