A system and method are disclosed for implementing dynamic set operations
on data stored in a sorted array using a hybrid red-black binary search
tree as a data structure. More particularly, the subject invention
facilitates the implementation of a binary search to access data items
stored in a sorted array by position, rather than by key value. This is
accomplished by generating a balanced red-black binary search tree for a
sorted array of data items wherein the information stored at each node of
the tree includes: a key value; a color; a left pointer to indicate the
presence of a child to the left of the node; a right pointer to indicate
the presence of a child to the right of the node; a count of descendents
along a branch to the left of the node; and a count of descendants along
a branch to the right of the node.