Binary Search Trees Quiz
Editorial
16 questions across the three Binary Search Trees lessons and the section's problems: the ordering rule and its walks, deleting and validating, reading the inorder, rotations, and floor and ceiling. Pick an answer to see whether it's right and why. Nothing is saved, so you can take it again.
If one trips you up, its lesson is Introduction to Binary Search Trees, BST Operations: Delete, Validate and Walk in Order or Balanced Trees and Ordered Sets.
Quiz
1 / 16Multiple choice
You search for 9 in the binary search tree built by inserting 7, 3, 11, 1, 5, 9, 13 in that order. Which values does the search compare?
Multiple choice
You insert 10, 20, 30, 40 and 50, in that order, into an empty binary search tree. What is its height, counted in edges?
Multiple choice
In the binary search tree built from 20, 10, 30, 5, 15, what are the floor of 12 and the ceiling of 16?
Multiple choice
10 has children 5 and 15, and 12 is 5's right child. Is this a binary search tree?
Multiple choice
You delete 20, which has two children, from the tree built from 20, 10, 30, 25, 35, using the successor. Which value takes 20's place?
Multiple choice
And what is that tree's inorder after the delete?
Multiple choice
In a valid binary search tree, a node is the right child of 8, and 8 is the left child of 15. Which values may the node hold?
Multiple choice
What is the 3rd smallest value in the tree built from 50, 30, 70, 20, 40?
Multiple choice
In the tree built from 50, 30, 70, 20, 40, 60, 80, which value comes right after 40 in the inorder?
Multiple choice
In the same tree, what is the lowest common ancestor of 40 and 60?
Multiple choice
Two values in a binary search tree were swapped, and its inorder now reads 1 2 8 4 5 6 3 9. Which two?
Multiple choice
Which binary search tree has the preorder 10, 5, 1, 7, 40, 50? (Written as LeetCode's list.)
Multiple choice
A binary search tree is a chain of 10 nodes, each the left child of the last. What is the most nodes the iterator's stack ever holds?
Multiple choice
You rotate right at the root of the tree built from 8, 4, 12, 2, 6. Which tree do you get?
Multiple choice
You insert 3, 2 and 1 into an AVL tree. Which value is at the root afterwards?
Multiple choice
A calendar holds [10, 20) and [30, 40). Which new booking is accepted?