-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
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
Making binary tree traversals lazy. #8725
Comments
+1 |
Absolutely, it's a great idea to switch from list-based traversals to generator-based traversals in the |
This comment was marked as off-topic.
This comment was marked as off-topic.
@digital-dev-07 Read the contributing guidelines.
|
…ixes TheAlgorithms#8725 completely. (TheAlgorithms#9237) * Made binary tree memory-friendly using generators based travels. Fixes TheAlgorithms#8725 * Made binary tree memory-friendly using generators based travels. Fixes TheAlgorithms#8725 * Fixed pre-commit errors
Feature description
Hi,
In binary_tree_traversals.py file, there are different kinds of traversals such as
preorder
,inorder
,postorder
and etc.Although the implementations are pretty clean one-liner like:
It isn't memory friendly. We can use generators instead not to load all the nodes into the memory:
Shall we go ahead and change them?
The text was updated successfully, but these errors were encountered: