Challenge 07: Binary tree operations


Problem overview

This will be another "hands on" version of the discussion in Dr. Plank's notes.

Most current interview questions exist in the final lab (lab 12). The goal of today's lecture is to have you insert, traverse, search, delete, and deconstruct a binary search tree.

Input / Output

Unlike other challenges, you should use the zoom whiteboard or a piece of paper to walk through these operations.

Perform the following tasks:

  1. Build a binary search tree with the recent members of the UTK Bioinformatics lab by inserting the following names in this specific order: Cai, Lu, Katrina, Ashley, Gabe, Shenglong.
  2. Walk through how you would find the name "Dr. Scott" in the tree you just constructed.
  3. Write down the in-order, and pre-order traversals of the tree above on a piece of paper or over zoom.
  4. Katrina and Gabe have recently defended their PhDs and will be joining the Cincinatti Children's Hospital and the Milwaukee School of Engineering as a senior research analyst and Asst. Professor, respectively. Talk through how you would delete them from the tree, Katrina first. Then create/draw the updated tree.
  5. Discuss with your small group an approach/pseudocode that would determine the height of the resulting tree.
  6. Discuss with your small group an approach/pseudocode that would deconstruct the tree. Specifically, what traversal should you use and why?

Submission

Given this is being tested in Lab 12, and almost guaranteed to be linked to final exam questions, I will not give participation credit but this should help you with your final two assignments.