emirpasic / gods

GoDS (Go Data Structures) - Sets, Lists, Stacks, Maps, Trees, Queues, and much more
Other
16.08k stars 1.75k forks source link

Get subtree sizes in AVL tree #96

Closed alexander-yu closed 2 years ago

alexander-yu commented 5 years ago

It would be a convenient feature for the AVL tree (or possibly the other tree implementations too) if we could have a method on each node that returns the size of the subtree rooted at that node.

emirpasic commented 2 years ago

Thank you for the PR, I have made use of some parts of the code and documented/tested and fixed some issues along the way, hence the other PR #191 which closes this one with the added functionality

emirpasic commented 2 years ago

Sample usage

tree.GetNode(3).Size()