Added a few doctests for traversals by naklecha · Pull Request #1149 · TheAlgorithms/Python · GitHub
Skip to content

Added a few doctests for traversals - #1149

Merged
cclauss merged 1 commit into
TheAlgorithms:masterfrom
naklecha:master
Aug 25, 2019
Merged

cclauss merged 1 commit into
TheAlgorithms:masterfrom
naklecha:master

Conversation

@naklecha

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@cclauss

cclauss commented Aug 25, 2019

Copy link
Copy Markdown
Member

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

@naklecha

Copy link
Copy Markdown
Contributor Author

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

@cclauss

cclauss commented Aug 25, 2019

Copy link
Copy Markdown
Member

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

@naklecha

Copy link
Copy Markdown
Contributor Author

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