Keeping a tree balanced
1.[3p] Why does a rotation preserve the binary search tree property?
Why does a rotation preserve the binary search tree property?
2.[2p] How many pointers does a single rotation have to change, regardless of subtree size?
How many pointers does a single rotation have to change, regardless of subtree size?
3.[3p] Inserting into an AVL node's left child's right subtree needs
Inserting into an AVL node's left child's right subtree needs
4.[3p] The fewest nodes in an AVL tree of height obey with and . What is ?
The fewest nodes in an AVL tree of height obey with and . What is ?
5.[3p] Using , what is the AVL height bound for a million keys?
Using , what is the AVL height bound for a million keys?
6.[2p] A red-black tree gives a tighter height bound than an AVL tree.
A red-black tree gives a tighter height bound than an AVL tree.
7.[3p] Why do most standard libraries ship red-black trees rather than AVL trees?
Why do most standard libraries ship red-black trees rather than AVL trees?
Select all that apply
8.[3p] A B-tree node holds about 1000 children. How many levels does it take to hold a billion keys?
A B-tree node holds about 1000 children. How many levels does it take to hold a billion keys?
9.[3p] Match each structure to what distinguishes it.
Match each structure to what distinguishes it.
AVL tree
Red-black tree
Treap
Splay tree
every path holds the same black count
subtree heights differ by at most one
a random priority kept in heap order
every accessed node rotated to the root
Show the answer
AVL tree: subtree heights differ by at most one Red-black tree: every path holds the same black count Treap: a random priority kept in heap order Splay tree: every accessed node rotated to the root