Created
October 9, 2011 16:38
-
-
Save pikeas/1273891 to your computer and use it in GitHub Desktop.
Recursion depth exceeded
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node: | |
def __init__(self, b, e, data, L, R): | |
self.b = b | |
self.e = e | |
self.L = L | |
self.R = R | |
self.data = data | |
class SegmentTree: | |
def __init__(self, N, quads): | |
def _init(b, e): | |
if b is e: | |
data = 'foo' #No dependency | |
return Node(b, e, data, None, None) | |
else: | |
mid = (b + e ) / 2 | |
L = _init(b, mid) | |
R = _init(mid + 1, e) | |
data = 'foo' #Data depends on values in L and R | |
return Node(b, e, q, L, R) | |
self.root = _init(1, N) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment