SarthakKeshari / Java-Questions-and-Solutions

This repository aims to solve and create new problems from different spheres of coding. A path to help students to get access to solutions and discuss their doubts.
MIT License
46 stars 95 forks source link

Searching Algorithms [Graph] #432

Closed nobita851 closed 2 years ago

nobita851 commented 2 years ago

Issue Id you have worked upon -

403

Briefly explain your program logic -

Created adjacency list representation of graph. Used Recursion for Depth First Traversal. Used Queue for Breadth First Traversal.

Screenshots:

Input Graph :
Vertex : Connected Vertices
     0 : [1, 4]
     1 : [2, 3, 4]
     2 : [1, 3]
     3 : [1, 2, 4]
     4 : [0, 1, 3]

image

image


Checklist: