Computer Science 226
Algorithms and Data Structures
Course Information |
Balanced Search Trees
Things to Know Before Lecture
- Understand what a 2-3 tree is.
Understand the basic red-black tree operations.
- How to search.
- How to insert.
It's not necessary to know how the whole process of red-black tree construction works since we'll be going through that as a mini-lecture, but we do want you to understand how to rotate a tree -- it can be awfully confusing at first, though it turns out to be a really simple idea.
- How to rotate left.
- How to rotate right.
- How to color flip.
Pre-Lecture Preparation Guide.
High priority videos are in red. Medium priority videos are in green. Low priority videos are in blue. If you are red-green colorblind and can't tell which are which, then you get to watch both and be extra prepared! For those of you who prefer to prepare by reading or looking through the old lecture slides, I have also tried to priortize the reading and lecture slides (decreasing in order of appearance).
Checkpoint 1: Starting with an empty 2-3 tree, insert the keys S, E, A, R, C, H, X, M, P, L. Check your answer on page 430 of the book.
Checkpoint 2: Given a tree, make sure you understand what it means to rotate a tree to the left or right. In other words, the following pictures should make sense to you. Think of 'rotate E left' as promoting e's right child in the only sensible way possible.