Question: Starting with a map represented by a rectangular grid height and width . Cells are numbered in the top left to in the bottom right.
Starting with a map represented by a rectangular grid height
and width
. Cells are numbered
in the top left to
in the bottom right. Each cell in the grid is either empty or contains an impassible object. All movement on the map are done as a single step to a cell that is adjacent horizontally or vertically. No diagonal movement is permitted.
Q): Write an algorithm that uses breadth first search to find the length of the shortest path from
to
. Return -1 if no such path exists. What is the worst case complexity for the algorithm? Please be sure to specify how the input size is measured.
please write the algorithm in pseudocode & explain each step.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
