We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 590dfc5 commit 92ef83cCopy full SHA for 92ef83c
Data_Structure/src/segment_tree.py
@@ -1,3 +1,14 @@
1
+'''
2
+Segment Tree is used for storing information about intervals, or segments.
3
+It allows querying which of the stored segments contain a given point.
4
+
5
+A segment tree for a set I of n intervals uses O(n log n) storage and can be built in O(n log n) time.
6
+Segment trees support searching for all the intervals that contain a query point in O(log n + k),
7
+k being the number of retrieved intervals or segments.
8
+\cite{https://en.m.wikipedia.org/wiki/Segment_tree }
9
10
11
12
from typing import TypeVar, List, Callable
13
from functools import reduce
14
0 commit comments