Skip to content

Commit 57a6755

Browse files
authored
Update TreeQueries.md
1 parent 1511595 commit 57a6755

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/Algorithms/Tree/TreeQueries.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ int query(int u, int v) {
142142
query implementation
143143
*/
144144

145-
// make depth[u] is always larger than or equal depth[u];
145+
// make depth[u] is always larger than or equal to depth[u];
146146
if (depth[u] < depth[v])
147147
swap(u, v)
148148

@@ -151,13 +151,13 @@ int query(int u, int v) {
151151
if (par[u][i] != -1 && depth[par[u][i]] >= h[v])
152152
u = par[u][i];
153153

154-
// if one of given node is parent of the other or given sane nodes u, v;
154+
// if one of given node is parent of the other or given the same nodes u, v;
155155
// return one of them.
156156
if (u == v)
157157
return u;
158158

159-
// make par[u][0] and par[v][0] target same node
160-
for (int i = MAXLOG -1; i >= 0; --i)
159+
// make par[u][0] and par[v][0] target the same node
160+
for (int i = MAXLOG - 1; i >= 0; --i)
161161
if (par[u][i] != par[v][i])
162162
v = par[v][i], u = par[u][i];
163163

0 commit comments

Comments
 (0)