Link Search Menu Expand Document (external link)

Algorithms & Common Tasks (Graphs)

Algorithms for traversing graphs


Which is better BFS or DFS?

It really depends on the problem you want to solve.

Breadth First (Nearest Neighbour) Depth First (Faraway)
Think wide Think deep
Use Queue Use Stack
Better near top Going deep to inspect each possibility
Social Networks (FB, LinkedIn) Game simulations (Like chess game) to predict
Nearby peers (Games/ Torrents)  

Table of contents