Computer Science 226
Algorithms and Data Structures
Spring 2013

Course Information | Assignments | Exercises | Lectures | Exams | Precepts | Booksite

Balanced Search Trees

Things to Know Before Lecture

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.

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).

2-3 Trees 0m - 11m
11m - 17m
p. 424-431 1-14 Demo
Left-leaning Red-black Tree 0m - 12m
12m - 22m
22m - 35m
p. 432-437
p. 437-440
p. 441-447
B-Tree 0m - 11m
p. 866-874 45-51

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.