Exit Ticket: Binary Search Trees

Data Structures & Algorithms

Question 1: Search Trace

Given the BST below, which nodes are visited (in order) when searching for key 11?

8 3 12 1 6 10 15 11

Question 2: Insertion

Using the same tree above, if we insert key 9, where does it attach?

Question 3: Runtime

Why is the runtime of search and insert O(h)?

Question 4: Deletion

When deleting a node with two children, what do we do?

Question 5: Reflection

In one sentence: what is the BST invariant, and why does it make search efficient?

One sentence is enough.