Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network

  Advanced Search  

PREPRINT. SoftwarePractice and Experience, 21(10):11251128, 1991. A Note on Searching in a Binary Search Tree

Summary: PREPRINT. Software­Practice and Experience, 21(10):1125­1128, 1991.
A Note on Searching in a Binary Search Tree
Arne Andersson
Department of Computer Science, Lund University,
BOX 118, S­221 00 Lund, Sweden

An algorithm for searching in a binary search tree using two­way comparisons is
presented. The number of comparisons required by this algorithm is only one more
than when using three­way comparisons. Since most high­level programming lan­
guages do not supply three­way comparisons, the number of comparisons used de
facto are reduced by a factor of two. We give experimental results to indicate the
speedup that may be achieved by the presented algorithm.
KEY WORDS: binary search tree, searching, two­way comparison, code optimization
An operation which is often assumed to be present when designing algorithms is the
three­way comparison with outcome !, = or ?. An example of an algorithm where
this operation is used is when searching an element in a binary search tree. This is a
fundamental algorithm and it is often presented in various text books and papers [1, 3,


Source: Andersson, Arne - Department of Information Technology, Uppsala Universitet


Collections: Computer Technologies and Information Sciences