Questions: Red-Black Trees

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Which pair of red-black properties together directly guarantees that tree height is O(log n)?

ARoot is black AND every null leaf is black
BRed nodes have only black children AND all root-to-leaf paths have equal black-node counts
CAll nodes are colored AND no two consecutive red nodes exist on any path
DRoot is black AND red nodes have only black children
Question 2 Multiple Choice

A team is choosing between an AVL tree and a red-black tree for a container that undergoes frequent insertions and deletions with occasional lookups. Which is the better choice and why?

AAVL tree — it has strictly tighter balance and therefore shorter height for the same node count
BRed-black tree — it requires fewer rotations per modification, making insertions and deletions cheaper
CAVL tree — red-black trees degenerate under many insertions
DRed-black tree — it guarantees O(1) average lookup time
Question 3 True / False

A new node is always inserted as red in a red-black tree because inserting it as black would immediately violate the black-height invariant.

TTrue
FFalse
Question 4 True / False

Red-black trees are more strictly balanced than AVL trees, so their height is typically shorter for the same number of nodes.

TTrue
FFalse
Question 5 Short Answer

Why does fixing a red-black violation after insertion require at most two rotations, regardless of tree size?

Think about your answer, then reveal below.