作者smilesaline (旅人)
看板Prob_Solve
标题[问题]几个关於资料结构的疑问
时间Mon Dec 4 09:46:27 2017
大家好,
最近在做资料结构的练习,但有一些疑问,还请各位前辈指点,谢谢!
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://webptt.com/cn.aspx?n=bbs/Prob_Solve/M.1512351989.A.0F2.html
1F:→ yr: 因为 root 是 0 12/04 10:26
2F:推 springman: 嗯、要看 root 是 0 还是 1 而定。 12/04 13:17
※ 编辑: smilesaline (42.116.28.98), 12/04/2017 15:56:44
3F:推 dhowdy: 2. 应该是9 comprisons没错@@ 12/05 04:18
4F:→ dhowdy: *comparisons 12/05 04:19