Design an algorithm for DFS and BFS traversal methods. Comment on its efficiency. Apply the same for the given graph
Answer:-
Algorithm : DFS
ALgorithm: BFS
Efficiency:-
Traversal Time : Θ(|V|2)
for adjacency list representation Θ(|V| + |E|).
V=no of vertices, E=no of edges
DFS:
BFS: