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

Skip to content

Commit e600253

Browse files
authored
Fix time complexity description for segment tree
Correct the number of merge operations in the time complexity explanation.
1 parent c1d2c5c commit e600253

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/data_structures/segment_tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ It is convenient to describe this operation recursively in the other direction,
7676

7777
We start the construction at the root vertex, and hence, we are able to compute the entire segment tree.
7878

79-
The time complexity of this construction is $O(n)$, assuming that the merge operation is constant time (the merge operation gets called $n$ times, which is equal to the number of internal nodes in the segment tree).
79+
The time complexity of this construction is $O(n)$, assuming that the merge operation is constant time (the merge operation gets called $n-1$ times, which is equal to the number of internal nodes in the segment tree).
8080

8181
### Sum queries
8282

0 commit comments

Comments
 (0)