- if (myrank > rchild) {
- /* I belong to the left subtree:
- - If I am the left child, compute real rank of my parent
- - Iterate down through tree:
- compute new size, shift ranks down, and update delta.
- */
- if (myrank == lchild) {
- tree->tree_prev = parent + delta;
- }
- size = size - rightsize - 1;
- delta = delta + rightsize;
- myrank = myrank - rightsize;
- parent = size - 1;
-
- } else {
- /* I belong to the right subtree:
- - If I am the right child, compute real rank of my parent
- - Iterate down through tree:
- compute new size and parent,
- but the delta and rank do not need to change.
- */
- if (myrank == rchild) {
- tree->tree_prev = parent + delta;
- }
- size = rightsize;
- parent = rchild;
+ size = size - rightsize - 1;
+ delta = delta + rightsize;
+ myrank = myrank - rightsize;
+ parent = size - 1;
+
+ } else {
+ /* I belong to the right subtree:
+ - If I am the right child, compute real rank of my parent
+ - Iterate down through tree:
+ compute new size and parent,
+ but the delta and rank do not need to change.
+ */
+ if (myrank == rchild) {
+ tree->tree_prev = parent + delta;