Overview

We’ll now consider another very useful kind of tree that maintains items in sorted order: a binary search tree.

Basic Learning Objectives

Before class, you should be able to:

  • Describe what a binary search tree is
  • Describe the differences between a binary tree and a binary search tree
  • Describe the operations of a binary search tree

Advanced Learning Objectives

After class, you should be able to:

  • Understand binary search tree operations and their implementations in Kotlin
  • Analyze the run-time of binary search tree operations

Resources

You should read the following:

Checks

Submit answers to the following on Moodle. Drawing out the trees will be tedious, so feel free to draw out your answers, take a picture or screenshot, and put it on Moodle.

  1. Which of the following binary trees are valid binary search trees? Why?

Three possible binary trees

  1. Given the following BST, what will it look like after trying to insert 42?

A binary search tree

  1. What will the same BST look like after trying to delete 49?

Acknowledgements

Check question from Prof. Jean Salac.