30/38
Part 7 of 7 · Follow-upsLearn

When changes and reads are both frequent on a deep tree, number the nodes in pre-order

Walking up is O(h)O(h) per change, and walking down is O(s)O(s) per read. Number the nodes in pre-order, and every subtree is one unbroken range of numbers.

Predict

Number the regions in pre-order from 0. Europe is 0 and Portugal is 1. Which numbers make up Portugal's subtree?

Pick an answer above to see the rest