Compare commits
1 commit
70337f097d
...
d7f1b286d0
Author | SHA1 | Date | |
---|---|---|---|
|
d7f1b286d0 |
2 changed files with 1 additions and 1 deletions
BIN
GA4/ga4.pdf
BIN
GA4/ga4.pdf
Binary file not shown.
|
@ -83,5 +83,5 @@ FUNCTION HELP-SETUP(G=(V,E), P, S, v):
|
|||
The $O(n)$ setup happens between line 2 and line 14. This is mainly needed to initialize some help arrays and define an arbitrary root
|
||||
(and consequent parent relation) on the tree.
|
||||
|
||||
The rest of the algorithm walks the tree from the start to the root and from the end to the root concurrently, keeping track of the path taken and stopping when an edge was traversed by both walks. Then, the path memory to the start is reversed and inserted in the path memory for the end in order to obtain a mapping to the next node in the path from $v$ to $w$. The complexity of this step is $O(dist(v,w))$, since the number of traversed edges is at most two times the distance from $v$ to $w$, and the reversing operation at the end requires at mos $dist(v,w)$ steps.
|
||||
The rest of the algorithm walks the tree from the start to the root and from the end to the root concurrently, keeping track of the path taken and stopping when an edge was traversed by both walks. Then, the path memory to the start is reversed and inserted in the path memory for the end in order to obtain a mapping to the next node in the path from $v$ to $w$. The complexity of this step is $O(dist(v,w))$, since the number of traversed edges is at most two times the distance from $v$ to $w$, and the reversing operation at the end requires at most $dist(v,w)$ steps.
|
||||
\end{document}
|
Reference in a new issue