Course week 13

Self-study

The topics for this week are the following: (i) Binary search trees, (ii) Balanced binary search trees

The following links will take you to the video-lectures and the accompanying slides:

Binary search trees

Suppose all the keys in a binary search tree (BST) are unique. Let \(x\) and \(y\) be two nodes in the BST whose keys are \(x.key\) and \(y.key\). Which of the following statements are always true? (More than 1 statement may be true.)
Suppose all the keys in a binary search tree (BST) are unique. When searching for a particular \(k\) key using a standard BST search algorithm, the algorithm reaches a leaf \(x\). Which of the following is true?
To obtain all the keys of a binary search tree in ascending order …
Suppose all the keys in a binary search tree (BST) are unique and we want to insert a new node having key \(k\) into the BST using the standard insert algorithm. What can be said about the position of the new node?
Suppose all the keys in a binary search tree (BST) are unique and let the tree have at least 1000 nodes. Let \(x\) be a leaf in the BST whose key is \(x.key\). If a new node \(y\) having key \(y\) is being inserted, which of the following claims is true?

Balanced binary search trees and the efficiency of binary search tree operations

Suppose a binary search tree (BST) has been formed by adding \(n\) nodes to an empty BST and \(n > 1000\). In addition suppose that we are performing a search for a key that does not occur in the BST. The worst case runtime efficiency for such a search is linear in \(n\). Which of the following properties does not correspond to a BST having this worst case runtime efficiency?
Suppose a rotation is performed on BST \(B1\) with the result being BST \(B2\). Which of the following is not a possible consequence of the rotation?
Which of the following is not true for an AVL binary search tree?
Suppose a binary search tree (BST) has been formed by adding \(n\) nodes to an empty BST and \(n > 1000\). Consider two alternatives: (I) in forming the BST nothing special is done to try to keep it balanced, (II) the BST is formed using either an AVL or a red-black BST. What advantage do we gain by in using alternative (II)?
What is a central question, related to this course, whose answer can be found in this week’s videos?
Of the following topics, which do you think deserves further discussion/explanation during the weekly consultation session?
Were there any parts of the video lectures that were particularly difficult? Particularly interesting? Something about which you wish to learn more?

Extra links on the topic:

A site where you can visualize operations on binary search trees

Week13 - Glossary

Submit weekly exercises

Questions to be submitted this week