Assignment 4
Tree
1. Given an array, WAP to implement a binary tree. Implement following functions:
a. Insertion
b. Deletion
2. Given a Binary Tree, WAP to find the sum of all nodes on the longest path from root to
leaf node.
3. Given a Binary Tree, WAP to check if all leaves are at same level or not.
4. Given a Binary tree and a number N, write a program to find the Nth node in the
Postorder traversal of the given Binary tree.
5. Given a binary tree, print its nodes according to the
a. Pre-order traversal
b. Post-order traversal
c. Inorder traversal
Graphs
1. WAP to implement following Graph traversals:
a. Breadth First Traversal (BFS)
b. Depth First Traversal (DFS)
2. Given a tree represented as undirected graph, WAP to count the number of nodes at given
level in a tree using BFS.
3. Given a directed graph, WAP to check whether the graph contains a cycle or not.
4. WAP to print degree of all the nodes in the given graph.
5. WAP to find the transpose of a directed graph.