Algorithms & Data Structures Question

 

I’m working on a algorithms & data structures exercise and need support to help me learn.

maze = [[ S, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],

[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],

[ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0],

[ 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0],

[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ],

[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, G ]]

S is start, G is destination, 0 is free space, and 1 is obstacle (cannot go through)

For the 2D array called maze above, use python

1. Can you help with finding the shortest path from S to G? Use 4 or 8 connectivity here: https://en.wikipedia.org/wiki/Pixel_connectivity
Then, print out the number of steps taken to reach the destination and find a way to visualize the path that was used to reach G.

2. Randomly generate the position of S and G, and repeat

 

 

This question has been answered.

Get Answer