看板 Prob_Solve 關於我們 聯絡資訊
大家好, 最近在做資料結構的練習,但有一些疑問,還請各位前輩指點,謝謝! 1. In a complete binary tree, what is the index number of the parent of the node numbered 20? Ans: 9 (為什麼不是10?) 2. How many comparisons would the insertion sort make on an array of 10 elements that is already in ascending order? Ans: 7 (為什麼不是9?) -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 42.116.28.98 ※ 文章網址: https://www.ptt.cc/bbs/Prob_Solve/M.1512351989.A.0F2.html
yr: 因為 root 是 0 12/04 10:26
springman: 嗯、要看 root 是 0 還是 1 而定。 12/04 13:17
※ 編輯: smilesaline (42.116.28.98), 12/04/2017 15:56:44
dhowdy: 2. 應該是9 comprisons沒錯@@ 12/05 04:18
dhowdy: *comparisons 12/05 04:19