AlgoFrames

Valid colorings

Standard · Trace the algorithm · about 6 min

Follow the check of this colouring against the three rules of a red-black tree. Answer each question before the step plays.

Example 1

Input:

{"levelOrder":[10,5,15,3,7,12,20],"colours":["B","R","B","R","B","B","B"]}

Output:

not valid

Red 5 has red child 3.

Learn the idea first: Red-black trees, a visual lesson.

More Red-black trees problems