Binary search trees (BST)
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.
Resources
Comprehension check
- True or false? A binary search tree is a rooted tree.
- True or false? A node in a binary tree may have three or more children.
- Given an interior node in the tree, the node’s left subtree contains only values _____ than that of the node.
- Average case complexity for insertion, finding, and deletion in a binary search tree is O(________).
Answers: u ƃol / ssǝl / ǝslɐɟ / ǝnɹʇ
Copyright © 2023–2025 Clayton Cafiero
No generative AI was used in producing this material. This was written the old-fashioned way.