binary search tree recursive subtree in java
Posted
by Art Peterson
on Stack Overflow
See other posts from Stack Overflow
or by Art Peterson
Published on 2010-04-08T02:24:25Z
Indexed on
2010/04/08
2:33 UTC
Read the original article
Hit count: 751
Can anyone point me to a code example (java preferably) or psuedocode that uses recursion to return a subtree that contains all nodes with keys between fromKey and toKey.
So if I was to call Tree.subtree(5,10) it should return all nodes in the BST that have keys between 5 and 10 inclusive - but I can't use loops or helper methods...only recursive calls to the subtree method, which takes fromKey and toKey as parameters.
Thanks!
© Stack Overflow or respective owner