BFS algorithm problem
- by Gorkamorka
The problem is as follows: A wanderer begins on the grid coordinates (x,y) and wants to reach the coordinates (0,0). From every gridpoint, the wanderer can go 8 steps north OR 3 steps south OR 5 steps east OR 6 steps west (8N/3S/5E/6W).
How can I find the shortest route from (X,Y) to (0,0) using breadth-first search?
Clarifications:
Unlimited grid
Negative coordinates are allowed
A queue (linked list or array) must be used
No obstacles present