Skip to content

Implement Order Statistic Tree (fixes #15)#24

Open
mdehoog wants to merge 3 commits intovadimg:masterfrom
mdehoog:master
Open

Implement Order Statistic Tree (fixes #15)#24
mdehoog wants to merge 3 commits intovadimg:masterfrom
mdehoog:master

Conversation

@mdehoog
Copy link

@mdehoog mdehoog commented Oct 25, 2016

I've added a size attribute to each node that tracks the size of the tree rooted at that node. This allows for a get(index) (getting the item at an index), and a rank(data) (getting the index of an item), both in O(logn) time.

See https://en.wikipedia.org/wiki/Order_statistic_tree.

 - Added size attributes to each tree node, which store the size of the tree below.
 - Added `get` method which provides retrieval of data by index.
 - Added `rank` method which returns the index of data.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant