InfinityUtils/RedBlackTree.h
Node* successor(Node* x) {
		// if the right subtree is not null,
		// the successor is the leftmost node in the
		// right subtree
		if (x->right != TNULL) {
			return minimum(x->right);
		}

		// else it is the lowest ancestor of x whose
		// left child is also an ancestor of x.
		Node* y = x->parent;
		while (y != TNULL && x == y->right) {
			x = y;
			y = y->parent;
		}
		return y;
	}
// find the successor of a given node

find the successor of a given node
find the successor of a given node
Node* successor(Node* x) {
		if (x->right != TNULL) {
			return minimum(x->right);
		}
		Node* y = x->parent;
		while (y != TNULL && x == y->right) {
			x = y;
			y = y->parent;
		}
		return y;
	}
Node * successor ( Node * x ) { if ( x -> right != TNULL ) { return minimum ( x -> right ) ; } Node * y = x -> parent ; while ( y != TNULL && x == y -> right ) { x = y ; y = y -> parent ; } return y ; }
find the successor of a given node
find the successor of a given node
// if the right subtree is not null,
 // the successor is the leftmost node in the
 // right subtree
 // else it is the lowest ancestor of x whose
 // left child is also an ancestor of x.
