Skip to content

Conversation

naklecha
Copy link
Contributor

Added a few doctests

>>> root = TreeNode(1)
>>> tree_node2 = TreeNode(2)
>>> tree_node3 = TreeNode(3)
>>> tree_node4 = TreeNode(4)
>>> tree_node5 = TreeNode(5)
>>> tree_node6 = TreeNode(6)
>>> tree_node7 = TreeNode(7)
>>> root.left, root.right = tree_node2, tree_node3
>>> tree_node2.left, tree_node2.right = tree_node4 , tree_node5
>>> tree_node3.left, tree_node3.right = tree_node6 , tree_node7

>>> pre_order(root)
1 2 4 5 3 6 7 

>>> in_order(root)
4 2 5 1 6 3 7 

>>> post_order(root)
4 5 2 6 7 3 1 

>>> level_order(root)
1 2 3 4 5 6 7 

>>> level_order_actual(root)
1 
2 3 
4 5 6 7 

>>> pre_order_iter(root)
1 2 4 5 3 6 7 

>>> in_order_iter(root)
4 2 5 1 6 3 7 

>>> post_order_iter(root)
4 5 2 6 7 3 1 

@naklecha naklecha mentioned this pull request Aug 25, 2019
10 tasks
@cclauss cclauss merged commit e694e59 into TheAlgorithms:master Aug 25, 2019
@naklecha
Copy link
Contributor Author

Thank you!

@cclauss
Copy link
Member

cclauss commented Aug 25, 2019

Thank you... Your the one who did the work.

@naklecha
Copy link
Contributor Author

This was my first contribution :)
Is there a method by which I can become a contributor?

@cclauss
Copy link
Member

cclauss commented Aug 25, 2019

Just keep contributing... Someone will notice. Or ask on Gitter (see README.md)

@naklecha
Copy link
Contributor Author

Okay! Thanks 👍

stokhos pushed a commit to stokhos/Python that referenced this pull request Jan 3, 2021
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

Successfully merging this pull request may close these issues.

2 participants