h**o 发帖数: 548 | 1 我觉得 rotation 不应该影响rank. 为什么 solution 说影响哪?
这是solution:
Consider a left rotation on node x, where the pre-rotation
right child of x is y (so that x becomes ys left child after the left
rotation). We leave rank[x] unchanged, and letting r = rank[y] before the
rotation, we set
rank[y] ←r + rank[x]. Right rotations are handled in an analogous manner. |
|