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 1 year 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