[理工] 台大电机 97资结 11 15题 tree rotation

楼主: dsa66253 (Kobe Mary)   2019-11-20 11:40:52
这边有两题很相近的题目,以前板上有讨论一次,只是查了之后发现跟洪逸老师有点出入
,所以拿出来再讨论清楚一点,他们讨论过11题
台大电机97 11(D)
After inserting a new node to an AVL tree, at most two rotation are needed to
re-balanced the tree.(False)
但讨论结果(True)
台大电机97 15 After inserting a new node to a red-black tree, at most two r
otation are needed to re-balanced the tree.(True)
讨论的结论:
AVL/R-B insert: [DS]1 Rotation [Algo]2 Rotation
AVL/R-B delete: [DS]2 Rotation [Algo]3 Rotation
是说因为algo视double rotation 为两次rotate,single rotation 为一次rotate。 在
insert时,最多可能发生一次double rotation,所以称为”at most two rotation”。
在deletion时,可能发生一次single rotation,再发生一次double rotation,所以”at
most three rotation”?

Links booklink

Contact Us: admin [ a t ] ucptt.com