avl-tree-c-sharp icon indicating copy to clipboard operation
avl-tree-c-sharp copied to clipboard

Method for search nodes before and after key not found

Open JoaoBaptMG opened this issue 6 years ago • 0 comments

This method adds something I think is missing from most (if not all) binary search tree implementations on .NET, and is something I needed implemented. SortedDictionary does not have it, neither do SortedSet.

The function added SearchLeftRight, looks for the key requested as usual. However, if it is not found, it returns (in its out parameters) the node values whose keys are immediately before and after the key that was requested, but not found. The specific objective I implemented this method was to be able to search for an angle in an ordered edge list from a vertex, in order to implement a doubly-connected edge list.

JoaoBaptMG avatar Nov 16 '18 12:11 JoaoBaptMG