They have similar working hours , but either they can significantly outperform others in any task simply because of the order in which the cells are visited.
In terms of space utilization, BFS will on average use more memory for trees , but for more general graphs, in some cases, it can use significantly less memory.
For brush strokes, in particular (if we define a maze, since there is only one way to get to a cell from the starting point without backtracking, which basically means this tree), BFS usually uses more memory since we will need to store several paths in memory at the same time, where DFS only needs to track one path at any given time.
, , , , , .
, . , DFS .
, , BFS ( A*), , DFS ( , ).