ā” Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 12s17 days 22 hours 20 minutes 12 seconds.
ā” Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 20m 12s17 days 22 hours 20 minutes 12 seconds.

Sign in to watch this lesson
Advanced - Trees Ā· 4:48
Binary lifting stores, for every vertex, its ancestors 1, 2, 4, 8, ... levels up, each built as two jumps of the level below, in O(n log n) time and memory. A lowest-common-ancestor query lifts one vertex from the largest jump down while it stays below the other's ancestors, so it costs O(log n), and the same table gives distances, k-th ancestors and path aggregates. For trees that grow leaf by leaf under tight memory, Harel-Tarjan style jump pointers keep one pointer per vertex with O(1) work per new leaf.