Week 110 of 145 · TAOCP Vol 3: Sorting and Searching

TAOCP 6.2.2 Binary Tree Searching

1 task, 3 steps. Open a task's steps to see exactly what to do; each guide has the detail.

Sign up or sign in to tick these off and give this week a due date.

By the end of this week you can

  • Implement BST insertion, search and deletion, including two-child deletion.
  • Explain why inserting keys in sorted order makes a degenerate tree.
  • Use dynamic programming to build an optimal BST from access frequencies.

Week 110 · Self-check

Three quick questions

Ungraded, and it never holds anything up. Pick an answer to see why.

  1. A BST is built by inserting 50 30 70 20 40 60 80. You delete 50 by replacing it with its in-order successor. What is the new root?
  2. You insert 1, 2, 3, 4, 5 in that order into an empty BST. How many levels does it have?
  3. Knuth's speedup for optimal BSTs restricts the root for keys i..j to which range?

Nothing is saved while signed out.

Discussion

0 posts

Stuck on week 110, or finished early? Say what you tried and what happened. Hints over answers: full solutions go in a spoiler.

No posts yet. Ask a question or share a tip.

Sign in to postAnyone can read. Posting needs an account with a confirmed email.

Spot a mistake? Report it