Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Order Statistic Tree (fixes #15) #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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.

None yet

1 participant