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 (reminder)

9.1.1 Searching

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



Best-case versus Worst-case

Binary Search Tree

Binary Search Trees, BST Sort -  MIT

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

9.2 AVL Trees

Insertion in an AVL Tree
Trinode Restructuring after an Insertion

Removal in an AVL Tree

Rebalancing after a Removal

Running Times for AVL Trees

AVL tree - visualisation

AVL Trees, AVL Sort - a lecture from MIT

9.2.2 C++ Implementation

html-9.8 (AVL Item)
html-9.9 (AVL Tree 2)
html-9.10 (AVL Tree 1)