I am having trouble in understanding order-statistics tree .
Every node in tree stores the number of descendants of itself .
Can you please explain the Algorithm or pseudocode how to Insert and Delete a node in the tree when tree is to be balanced .
Basically i want to find the rank of an element in the tree in O(log N) time complexity and nodes can be inserted and deleted in between querries .
P.S. I am able to understand the rank(x) operation .