0% found this document useful (0 votes)
171 views1 page

Assignment Tree, Graphs

The document outlines programming assignments involving binary trees and graphs. For binary trees, it includes implementing insertion and deletion in a binary tree, finding the longest path sum from root to leaf, checking if all leaves are at the same level, and finding the Nth node in postorder traversal. For graphs, it includes implementing BFS and DFS, counting nodes at a given level using BFS, checking for cycles in a directed graph, printing the degree of nodes, and finding the transpose of a directed graph.

Uploaded by

Shubham Bakshi
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)
171 views1 page

Assignment Tree, Graphs

The document outlines programming assignments involving binary trees and graphs. For binary trees, it includes implementing insertion and deletion in a binary tree, finding the longest path sum from root to leaf, checking if all leaves are at the same level, and finding the Nth node in postorder traversal. For graphs, it includes implementing BFS and DFS, counting nodes at a given level using BFS, checking for cycles in a directed graph, printing the degree of nodes, and finding the transpose of a directed graph.

Uploaded by

Shubham Bakshi
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

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.

You might also like