Skip to content

Commit 43ad356

Browse files
authored
Merge pull request #1150 from fffelix-huang/fix_typo
Fix typos
2 parents 59d3470 + d71651b commit 43ad356

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/graph/bridge-searching-online.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ We will now consistently disassemble every operation that we need to learn to im
7979
For example you can re-root the tree of vertex $a$, and then attach it to another tree by setting the ancestor of $a$ to $b$.
8080

8181
However the question about the effectiveness of the re-rooting operation arises:
82-
in order to re-root the tree with the root $r$ to the vertex $v$, it is necessary to necessary to visit all vertices on the path between $v$ and $r$ and redirect the pointers `par[]` in the opposite direction, and also change the references to the ancestors in the DSU that is responsible for the connected components.
82+
in order to re-root the tree with the root $r$ to the vertex $v$, it is necessary to visit all vertices on the path between $v$ and $r$ and redirect the pointers `par[]` in the opposite direction, and also change the references to the ancestors in the DSU that is responsible for the connected components.
8383

8484
Thus, the cost of re-rooting is $O(h)$, where $h$ is the height of the tree.
8585
You can make an even worse estimate by saying that the cost is $O(\text{size})$ where $\text{size}$ is the number of vertices in the tree.
@@ -103,7 +103,7 @@ We will now consistently disassemble every operation that we need to learn to im
103103

104104
* Searching for the cycle formed by adding a new edge $(a, b)$.
105105
Since $a$ and $b$ are already connected in the tree we need to find the [Lowest Common Ancestor](lca.md) of the vertices $a$ and $b$.
106-
The cycle will consist of the paths from $b$ to the LCA, from the LCA to $b$ and the edge $a$ to $b$.
106+
The cycle will consist of the paths from $b$ to the LCA, from the LCA to $a$ and the edge $a$ to $b$.
107107

108108
After finding the cycle we compress all vertices of the detected cycle into one vertex.
109109
This means that we already have a complexity proportional to the cycle length, which means that we also can use any LCA algorithm proportional to the length, and don't have to use any fast one.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy