We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

A variation where a stack is used instead of recursion. I do not fancy recursion in Python as the maximum recursion depth is about 1000 per default. With the stack (a deque could also be used), you avoid a potential recursion limit error.

With the stack, no helper method is needed either.

## Trees: Is This a Binary Search Tree?

You are viewing a single comment's thread. Return to all comments →

A variation where a stack is used instead of recursion. I do not fancy recursion in Python as the maximum recursion depth is about 1000 per default. With the stack (a deque could also be used), you avoid a potential recursion limit error.

With the stack, no helper method is needed either.