《算法导论》笔记3-13

红黑树

旋转:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
left_rotate(T, root)
rChild = root.right
root.right = rChild.left
if rChild.left != T.null
rChild.left.parent = root
rChild.parent = root.parent
if root.parent == T.null
T.root = rChild
elif root == root.parent.left
root.parent.left = rChild
else
root.parent.right = rChild
rChild.left = root
root.parent = rChild

插入:

Author

Zoctan

Posted on

2018-03-29

Updated on

2023-03-14

Licensed under