Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 91eecf3

Browse files
committed
Remove "not" in explanation of binary lifting
1 parent 62bb4d3 commit 91eecf3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/graph/lca_binary_lifting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ We will describe this process in more detail.
2828
Let `L = ceil(log(N))`.
2929
Suppose first that `i = L`.
3030
If `up[u][i]` is not an ancestor of `v`, then we can assign `u = up[u][i]` and decrement `i`.
31-
If `up[u][i]` is not an ancestor, then we just decrement `i`.
31+
If `up[u][i]` is an ancestor, then we just decrement `i`.
3232
Clearly after doing this for all non-negative `i` the node `u` will be the desired node - i.e. `u` is still not an ancestor of `v`, but `up[u][0]` is.
3333

3434
Now, obviously, the answer to LCA will be `up[u][0]` - i.e., the smallest node among the ancestors of the node `u`, which is also an ancestor of `v`.

0 commit comments

Comments
 (0)