From e60025351d0b6eb68c33f6db61f7f70ff65b1c02 Mon Sep 17 00:00:00 2001 From: Apataras <24808043+Apataras@users.noreply.github.com> Date: Fri, 7 Nov 2025 15:43:05 +0100 Subject: [PATCH] Fix time complexity description for segment tree Correct the number of merge operations in the time complexity explanation. --- src/data_structures/segment_tree.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data_structures/segment_tree.md b/src/data_structures/segment_tree.md index 3e4948e8c..74b51a4c9 100644 --- a/src/data_structures/segment_tree.md +++ b/src/data_structures/segment_tree.md @@ -76,7 +76,7 @@ It is convenient to describe this operation recursively in the other direction, We start the construction at the root vertex, and hence, we are able to compute the entire segment tree. -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). +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). ### Sum queries