age-viewer icon indicating copy to clipboard operation
age-viewer copied to clipboard

What are DFS(Depth First Search) and BFS(Breadth First Search) algorithms ?

Open aked21 opened this issue 2 years ago • 3 comments

aked21 avatar Oct 11 '22 13:10 aked21

excited to learn about DFS and BFS

MJinH avatar Oct 13 '22 23:10 MJinH

I believe DFS (Depth First Search) is a technique for traversing data in graphs and it uses stack data structure. The DFS is usually a recursive algorithm and it pushes the first visited vertices into the stack and if the next vertex does not exist, then the vertices in the stack are popped. Whereas BFS (Breadth First Search) is a technique for traversing the shortest path in graphs and it uses queue data structure.

MJinH avatar Oct 13 '22 23:10 MJinH

Here's some useful information. https://adrianmejia.com/data-structures-for-beginners-graphs-time-complexity-tutorial/

shinhanbyeol avatar Oct 14 '22 07:10 shinhanbyeol

I have written DFS and BFS along with their traversal that is self explanatory. Hope you'll understand it and found this as good solution.

@aked21 @shinhanbyeol DFS and BFS.docx

Nimra-1234 avatar Dec 10 '22 20:12 Nimra-1234

@shinhanbyeol I guess this will help you. If it is so then you can close this issue.

I have written DFS and BFS along with their traversal that is self explanatory. Hope you'll understand it and found this as good solution.

@aked21 @shinhanbyeol DFS and BFS.docx

Nimra-1234 avatar Dec 24 '22 12:12 Nimra-1234

Thank you. @Nimra-1234 @MJinH

shinhanbyeol avatar Dec 29 '22 08:12 shinhanbyeol