Returns the left child index for a given index in a binary tree. >>> s = SegmentTree([1, 2, 3]) >>> s.left(1) 2 >>> s.left(2) 4
(self, idx)
| 12 | self.build(1, 0, self.N - 1) |
| 13 | |
| 14 | def left(self, idx): |
| 15 | """ |
| 16 | Returns the left child index for a given index in a binary tree. |
| 17 | |
| 18 | >>> s = SegmentTree([1, 2, 3]) |
| 19 | >>> s.left(1) |
| 20 | 2 |
| 21 | >>> s.left(2) |
| 22 | 4 |
| 23 | """ |
| 24 | return idx * 2 |
| 25 | |
| 26 | def right(self, idx): |
| 27 | """ |
no outgoing calls
no test coverage detected