mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-04-21 13:17:35 +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] * (
|
self.st = [0] * (
|
||||||
4 * self.N
|
4 * self.N
|
||||||
) # approximate the overall size of segment tree with array 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):
|
def left(self, idx):
|
||||||
return idx * 2
|
return idx * 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user