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

Practice Problems Graphs I

Uploaded by

salaarmasood321
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)
6 views2 pages

Practice Problems Graphs I

Uploaded by

salaarmasood321
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/ 2

CS 202 – Data Structures

Practice Problems: Graphs-I


1. What is the Euler path? How do you figure out that a given graph contains a Euler path?
Cost?
2. What is the Hamiltonian path? How do you figure out that a given graph contains a
Hamiltonian path? Cost?
3. Give an adjacency-list representation for a complete binary tree (heap) on 7 vertices.
4. Given an adjacency-matrix representation of a directed graph, how long does it take to
compute the out-degree of every vertex? How long does it take to compute the in-
degree of every vertex?
5. Please re-do and re-think the above exercise for adjacency list representation.
6. Describe efficient algorithms for computing GT from G for both representations. Also,
compute their complexities.
7. Describe efficient algorithms for computing G2 from G for both the adjacency list and
adjacency-matrix representations of G. Analyze the running times of your algorithms.
8. Design an efficient algorithm to determine whether there is a path between two given
vertices of the graph. Complexity?
9. Design an efficient algorithm to determine whether the given graph is a tree?
Complexity?
10. Design an efficient algorithm to determine whether there is a cycle in the graph? What
will be the complexity?
11. Classify all edges of the following graph into tree, cross, back and forward edges. Run
DFS starting at vertex B.

12. How can we use DFS to figure out if there is a path from every vertex to every other
vertex?
13. Design an efficient algorithm to check if the number of the graph is a directed acyclic
graph (DAG). What will be the complexity?

Dr. Malik Jahan Khan April 18, 2024


CS 202 – Data Structures

14. Design an efficient algorithm to check if all vertices are part of a single cycle. What will
be the complexity?
15. Design an efficient algorithm to check if all vertices are part of some cycle of more than
2 vertices. What will be the complexity?
16. Design an efficient algorithm to check if there exists a pair of vertices (u, v) such that
there is a path from u to v and there is a path from v to u. Complexity?
17. Design an efficient algorithm to check if there exists a pair of vertices (u, v) such that
there is a path from u to v but there is no path from v to u. Complexity?
18. Design an efficient algorithm to check if there exists no such pair of vertices (u, v) such
that there is a path from u to v and a there is a path from v to u. Complexity?
19. Design an efficient algorithm to check if there exists no such pair of vertices (u, v) such
that there is a path from u to v but there is no path from v to u. Complexity?
20. Design an efficient algorithm to check if all vertices are part of a tree (there may be
more than one tree). Complexity?

Dr. Malik Jahan Khan April 18, 2024

You might also like