0% found this document useful (0 votes)
10 views

Assignment8 Tree

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Assignment8 Tree

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Assignment 8: Tree

1. Write a program to create a Binary Tree.


2. Write a program to determine if a binary tree is
a. Strict binary tree
b. Complete
c. Almost complete
3. Two binary trees are similar if they are both empty or if they are both
nonempty. Their left subtrees are similar, and their right subtrees are similar.
Write an algorithm to determine if two binary trees are similar.
4. Write a recursive program to traverse a binary tree using the following
traversal:
a. Inorder Traversal
b. Preorder Traversal
c. Postorder Traversal
5. Write an iterative program to traverse a binary tree using the following
traversal:
a. Inorder Traversal
b. Preorder Traversal
c. Postorder Traversal
6. Write a program that accepts a binary tree representing an expression and
returns the infix version of the expression that contains only those parentheses
that are necessary.
7. Write a program to perform level-order traversal of a binary tree.
8. Write a program to generate tree from a given Pre-order and Inorder Traversal
of a binary tree.
9. Write a program to generate tree from a given Postorder and Inorder Traversal
of a binary tree.
10.Write a program to count the height of a binary tree
11.Write a program to count the total number of nodes in a binary tree
12.Write a program to count the number of following nodes in a binary tree:
a. Nodes with Degree Zero (0)
b. Nodes with Degree One (1)
c. Nodes with Degree Two (2)

You might also like