Chapter 9: Search Trees I

We study several alternative data structures based on trees for realizing ordered dictionary. The fundamental operations in an ordered dictionary ADT are:

9.1 Binary Search Trees

BinarySearchTrees.pdf  5


9.1.1 Searching

BinarySearchTrees.pdf  6
Algorithm find (k, v)
    if T.isExternal (v)
        return Position(null)
   if k < key(v)
        return find(k, T.leftChild(v))
   else if k = key(v)
        return Position(v)
   else { k > key(v) }
return find(k, T.rightChild(v))


Analysis of Binary Tree Searching

9.1.2 Update Operations

Insertion
BinarySearchTrees.pdf  7



Removal
BinarySearchTrees.pdf  8, 9





Best-case versus Worst-case
BinarySearchTrees.pdf  10


9.1.3 C++ Implementation

A Binary Search Tree in C++
html-9.2 (Position)
html-9.3 (BST1)
html-9.4 (BST2)
html-9.5 (BST3)
html-9.6 (BST4)

except.h  -   LBTree.h   -   BSTree.cpp