Question: Graph Algorithms You are given a map of a labyrinth, and your task is to find a path from start to end. You can walk
Graph Algorithms
You are given a map of a labyrinth, and your task is to find a path from start to end. You can walk left, right, up and down.
Input
The first input line has two integers and : the height and width of the map. Then there are lines of characters describing the labyrinth. Each character is floor # wall A start or end There is exactly one A and one B in the input.
Output
First print "YES", if there is a path, and NO otherwise.
Example
Input:
########
#A##
####B#
##
########
Output:
YES
NB: Solve using Breadth First Search BFS Algorithm considering the adjacent cells are adjacent nodes.
Use Java programming language.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
