MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / __init__

Method __init__

data_structures/binary_tree/lazy_segment_tree.py:7–13  ·  view source on GitHub ↗
(self, size: int)

Source from the content-addressed store, hash-verified

5
6class SegmentTree:
7 def __init__(self, size: int) -> None:
8 self.size = size
9 # approximate the overall size of segment tree with given value
10 self.segment_tree = [0 for i in range(4 * size)]
11 # create array to store lazy update
12 self.lazy = [0 for i in range(4 * size)]
13 self.flag = [0 for i in range(4 * size)] # flag for lazy update
14
15 def left(self, idx: int) -> int:
16 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected