Skip to content
New issue

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

4.1 could be optimised #98

Open
damluar opened this issue Jan 31, 2015 · 0 comments
Open

4.1 could be optimised #98

damluar opened this issue Jan 31, 2015 · 0 comments

Comments

@damluar
Copy link

damluar commented Jan 31, 2015

We could add simple checks to avoid unnecessary traversal in case of unbalanced tree.
For example if a node has no elements in its right subtree, it makes no sense to traverse its left subtree for levels higher than 1. So if we reach 2nd level in the left subtree, we already know that the tree is unbalanced.
Also after processing left subtree we have its height and we could limit the maximum depth of traversal for the right subtree to this value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant