Graph Theory37 sections · 1633 units
Open in Course

Recurrence Relation

Build from previous

How do you compute up[v][j] for j1j \geq 1? Use this recurrence:

up[v][j] = up[up[v][j-1]][j-1]

In words: to jump 2j2^j steps from vv, first jump 2j12^{j-1} steps (landing at up[v][j-1]), then jump another 2j12^{j-1} steps from there. Since 2j1+2j1=2j2^{j-1} + 2^{j-1} = 2^j, you have jumped the right distance. This is the same idea as repeated squaring in fast exponentiation. Break the big jump into two equal halves.