We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The solution for bst_validate won't work if the tree has a node with the value of -sys.maxsize.
A suggested tweak would be to use None instead of sys.maxsize and -sys.maxsize.
class BstValidate(Bst): def validate(self): if self.root is None: raise TypeError('No root node') return self._validate(self.root) def _validate(self, node, minimum=None, maximum=None): if node is None: return True if not ((minimum is None or node.data>minimum) and (maximum is None or node.data<=maximum)): return False if not self._validate(node.left, minimum, node.data): return False if not self._validate(node.right, node.data, maximum): return False return True
I would be happy to prepare a PR if this makes sense to you.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The solution for bst_validate won't work if the tree has a node with the value of -sys.maxsize.
A suggested tweak would be to use None instead of sys.maxsize and -sys.maxsize.
I would be happy to prepare a PR if this makes sense to you.
The text was updated successfully, but these errors were encountered: