Compare commits

..

1 commit

Author SHA1 Message Date
Claudio Maggioni
d7f1b286d0 Added GA4 EX1 2019-05-21 12:17:08 +02:00
2 changed files with 1 additions and 1 deletions

Binary file not shown.

View file

@ -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}