Look up, insert, delete: one trail
transcript
A search tree holds ids. You may look up an id, add one, or remove one. Each job starts the same way.
Compare the key with a node. A smaller key goes left. A larger key goes right. Equal means you found it. Stop there.
Insert five into the street tree. The top is eight. Go left to three, right to six, left to four. Four has no right child. The trail ends. Five becomes that child. Only one link changed, and nothing else moved.
A lookup reports the trail it walked. An insert hangs a leaf on the missing child. A delete replaces the node it found.
The cost of each job is the length of the trail. A sorted insert order makes a chain. A thousand ids need a thousand steps. A balanced tree needs at most ten.
Follow one trail from the top. Change only the end of it. Full breakdown in the lecture.