作者mickeyha (M*schief)
看板Grad-ProbAsk
標題[理工] [資結] 95台大電機
時間Tue Jan 24 22:45:57 2012
The complexity of inserting a node into an arbitrary
binary search tree is (n is the number of nodes in the tree):
[註]arbitrary - 任意
問:ramdonized data建立BST時間複雜度 => ?
想請問這題答案該寫O(nlogn) 還是O(n)呢?
Top-down Bottom-up
感謝:)
--
Why Not :-P
http://whynot-p.blogspot.com/
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 1.162.56.71
推 mqazz1:top-down跟bottom-up那個是建heap的複雜度吧 01/24 22:48
→ mqazz1:我記得某年台大的考題是要證random建BST是O(nlgn) 01/24 22:49
→ mickeyha:完蛋 翻錯頁XDDD 01/24 22:52
→ mickeyha:我翻Cormen查到期望高度為O(lgn) 01/24 23:18
→ mickeyha:請問因有n個資料每次皆須調整O(lgn)所以答案是O(nlgn)嗎? 01/24 23:19
推 magicnick:BST 不用balance 所以就O(logN) 01/25 15:41