by wfunction · 11y ago · 0 comments
def inverse(t): return Node(inverse(t.r), t.v, inverse(t.l)) if t else t
or if you must do it in place, 3 lines... def invert(t):
if t: (t.l, t.r) = (invert(t.r), t.v, invert(t.l))
return tNo comments yet.