0% found this document useful (0 votes)
56 views2 pages

Data Structures Assignment 2

The document provides the results of tree traversal methods: inorder, preorder, and postorder, with their respective outputs listed. It also includes pseudocode for each traversal method, detailing the steps to execute them. The pseudocode outlines the recursive approach for traversing binary trees in different orders.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
56 views2 pages

Data Structures Assignment 2

The document provides the results of tree traversal methods: inorder, preorder, and postorder, with their respective outputs listed. It also includes pseudocode for each traversal method, detailing the steps to execute them. The pseudocode outlines the recursive approach for traversing binary trees in different orders.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 2

50

30 60

19 43

1. Inorder (Left, Root, Right)

19,30,43,50,60

Preorder (Root, Left, Right)

50,30,19,43,60

Postorder(Left, Right, Root)

50,30,60,19,43

2. Pseudocode for inorder Traversal

Inorder(tree)

Begin

If tree is null, return;

Inorder(tree.left_subtree)

Print(tree.root)

Inorder(tree.right_subtree)

End
Pseudocode for Preorder Traversal

Preorder(tree)

Begin

If tree is null, return;

Preorder(tree.root)

Print(tree.left_subtree)

preorder(tree.right_subtree)

End

Pseudocode for Postorder Traversal

Postorder(tree)

Begin

If tree is null, return;

postorder(tree.left_subtree)

print(tree.right_subtree)

Postorder(tree.root)

End

You might also like