mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-27 15:01:08 +00:00
Handle empty input case in Segment Tree build process (#8718)
This commit is contained in:
parent
629eb86ce0
commit
0b0214c42f
|
@ -7,7 +7,8 @@ class SegmentTree:
|
|||
self.st = [0] * (
|
||||
4 * self.N
|
||||
) # approximate the overall size of segment tree with array N
|
||||
self.build(1, 0, self.N - 1)
|
||||
if self.N:
|
||||
self.build(1, 0, self.N - 1)
|
||||
|
||||
def left(self, idx):
|
||||
return idx * 2
|
||||
|
|
Loading…
Reference in New Issue
Block a user