CSUMB

CST370 - Learning Journal 3

Author

Date Published

CSUMB logo 2

Learning Journal #3


This week we learned all about Depth First Search and Breadth First Search which are key concepts I wanted to gather from this class. Basically, I wanted to understand in what situations would you use one over the other. And this is my current reasoning


Breadth First Search

You want to use Breadth first search when you want to find the shortest possible path on a graph. It uses high memory because it needs to load the entire graph but, it is very computationally efficient because the first path is always the shortest. This would be great to use in the Battle Code Game because memory is not restricted but, compute is.

Depth First Search

Depth first search recursively analyzes every path in a tree via backtracking. This allows the algorithm to understand whether a desired path even exists. This is great for analyzing a structure and grabbing ALL the data. I assume this is useful for many applications but, when it comes to game programming this seems horribly inefficient.


Typically I imagine that BFS is preferred over DFS considering that memory at least used to be much cheaper than computational power. Even with RAM prices skyrocketing I don't think it will make sense iterating over EVERY Possible solution rather than just loading the entire graph into memory and just KNOWING the best solution.


Comments

Join the conversation! Login to reply to comments