Binary search trees (BST)

Published

2023-08-05

Binary search tree (16:05)

Now that we’re getting into more complex data structures, having more complex operations, it’s helpful to have a tool for visualization. Here’s a tool developed by David Galles, formerly of University of San Francisco, now a staff engineer at Google. Try inserting a few nodes with numeric values, then try searching and deleting. See if you can create examples of case 4 for deletion, where the left child of the target node has a right child.

Binary search tree visualization

Resources

Comprehension check

  1. True or false? A binary search tree is a rooted tree.
  2. True or false? A node in a binary tree may have three or more children.
  3. Given an interior node in the tree, the node’s left subtree contains only values _____ than that of the node.
  4. Average case complexity for insertion, finding, and deletion in a binary search tree is O(________).

Answers: u ƃol / ssǝl / ǝslɐɟ / ǝnɹʇ

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.