• Medientyp: E-Artikel
  • Titel: Untangling the balancing and searching of balanced binary search trees
  • Beteiligte: Austern, Matthew H.; Stroustrup, Bjarne; Thorup, Mikkel; Wilkinson, John
  • Erschienen: Wiley, 2003
  • Erschienen in: Software: Practice and Experience
  • Sprache: Englisch
  • DOI: 10.1002/spe.564
  • ISSN: 0038-0644; 1097-024X
  • Schlagwörter: Software
  • Entstehung:
  • Anmerkungen:
  • Beschreibung: <jats:title>Abstract</jats:title><jats:p>A balanced binary search tree can be characterized by two orthogonal issues: its search strategy and its balancing strategy. In this paper, we show how to decouple search and balancing strategies so that they can be expressed independently of each other, communicating only by basic operations such as rotations. Different balancing strategies, such as red–black trees and splay trees, and different search applications, such as key search and rank search, can be combined arbitrarily. As a new result, we show how optimal string search can be expressed as a search application on any balanced binary tree.</jats:p><jats:p>We implement our framework in C++, with the heavy use of templates and inlining. It keeps balancing and searching separate, while still delivering a performance that compares favorably to widely used binary tree implementations. Common services, such as correctness checks and timing measurements, do not have to be rewritten for each tree implementation. The common framework simplifies experimentation with trees and search algorithms; as a demonstration, we present some simple comparisons of red–black trees, splay trees and treaps. Copyright © 2003 John Wiley &amp; Sons, Ltd.</jats:p>