lecture 11.4
1. rand(), 规定最大值,随机返回数字
2. splay tree(rebalance by themselves, 还有两种树也可以,下节课讲)
考虑parent,child,grandchild
double rotation

3. splay tree四种分类


4. 为了让tree rebalancing,可以利用rotation
left rotation:把右边的child变成root
right rotation:把左边的child变成root

n2=left(n1)
left(n1)=right(n2)
right(n2)=n1


5. insertion at root

6. rebalancing tree
把中间值移到root,故而需要counter记录数量有多少
partition(tree,i),将tree重新排列,i作为新的root

浙公网安备 33010602011771号