Equal depths first
transcript
Each hub knows only its parent. Two parcels start at two hubs. Where do their routes meet? No walk down from the top is possible. Climb, but fix the depths first.
Hub four has three links to the top. Count the links by climbing to the top. Hub five has two links to the top. Climbing both together would miss.
Lift hub four once, to hub three. Equal depths mean the same step to any shared hub. Now both have depth two. Lift both. Lift both again, to hub zero. They are the same hub. Zero is the answer.
With equal depths, a shared hub is the same distance above both. With unequal depths, the climbs pass each other. So lift the lower hub by the difference. Lifting the higher hub would waste steps.
Lift the lower hub, then both. The cost is a few climbs of the height. Use loops, never deep recursion. Full breakdown in the lecture.