Abstract

Search in a conventional binary search tree requires three-way key comparison (<, =, >). High-level language support for three-way branch on comparison is rare, and experiments have shown that a modified tree requiring only two-way key comparison (<, ⩾) can achieve substantial search speedup. We analyze search costs in the conventional and modified trees. Our analysis shows that two-way comparison need only be slightly faster than three-way comparison for the modified tree algorithm to be superior. Moreover, search costs for the modified tree fit the alphabetic code tree model, so that an optimal tree for the modified algorithm can be constructed in O( n log n) time, versus O( n 2) time for an optimal binary search tree.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call