Description
Recently in Meshes.jl #1168 the idea was suggested to update BinaryTrees with traversal methods. For our uses in that PR, finding the minimum value in the tree and finding the minimum and maximum within a subtree are what's needed. Currently the implementations (_leftmost
and _bst_minimum
and _bst_maximum
) use simple recursion. We should probably find new names too. minimum
would make sense to replace _leftmost
, just may need a StatsBase import (potentially there's another option, let me know what you think). The subtree minimum-maximum I'm not sure about.
Within that PR there's also find_above_below
which traverses the tree to find a key and outputs the adjacent keys. I think this is necessary because you can have
6
/ \
3 other stuff to balance the tree
/ \
2 4
/
1
and if you want what's below and above two and four, you need to backtrack or store common parents (current implementation).
Would we like to include this since it is functionally an advanced search via traversal?
And as a bonus, we could add the standard full tree traversals, if so desired.
Let me know your perspective, suggestions, etc.
Activity