Skip to content

Commit 92ef83c

Browse files
Add Description Of Segment Trees
1 parent 590dfc5 commit 92ef83c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Data_Structure/src/segment_tree.py

+11
Original file line numberDiff line numberDiff line change
@@ -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+
112
from typing import TypeVar, List, Callable
213
from functools import reduce
314

0 commit comments

Comments
 (0)