Saturday, September 18, 2021

Search Algorithms

 There are two basic search algorithms examined in our lecture. One can

move between them by merely changing the code at line 128 from between

stack and queue.



Definitions

DFS (stack):



BFS (queue)



Maze1


On this first maze, both reach the correct solution in 11 - 1 moves.

Maze2





Again, both arrive at the optimal solution, but with very different search histories.

DFS is normally used for shortest route problems.

Maze3



Here, DFS stops at a long path. DFS is trusted for maze problems with a uniquesolution.


                                                              *     *     *



No comments: