Binary Search Tree : Lowest Common Ancestor

  • + 0 comments

    Cleaned up a little:

    while root:
        if v1<root.info and v2<root.info:
            root=root.left
        elif v1>root.info and v2>root.info:
            root=root.right
        else:
            return root