作者waterman815 ()
看板Grad-ProbAsk
標題[理工] DS AVL TREE 觀念請教
時間Fri Dec 12 20:50:30 2014
最近有寫到一題題目
after inserting a new node to an AVL tree , at most two rotations are needed
to rebalance the tree
這個選項是錯誤的,解答說 只需要一次rotation即可
但是 翻過一些書以及洪逸筆記
rotation 有分成兩種
分別是 single rotation (LL RR) 以及 double rotation (LR RL)
我的解讀是,假設rotaion狀況是LR 或是 RL ,則rotation的次數就是兩次
也就是說insert a new node to an AVL tree , at most two rotations are needed
to rebalance the tree這句話是對的
不知道要怎麼解讀才是正確的,請版上大大解惑了
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.119.202.112
※ 文章網址: http://www.ptt.cc/bbs/Grad-ProbAsk/M.1418388636.A.513.html
推 FRAXIS: 要兩次.. 12/13 00:12
推 maque: 實際上LR RL是兩次旋轉,洪逸筆記上印象中有備註DS考答案題 12/13 19:05
→ maque: 寫一次 12/13 19:05
→ waterman815: 瞭解,謝謝以上兩位說明 12/14 11:53