Shortest path in matrix tutorial


Backstory: A matrix is a 2D array, an extension of an array. Meanwhile, matrix is one of the representation of graph, known as “Adjacency Matrix”. Shortest path in matrix tutorial explains how to use breath first search (BFS) to print the shortest path between two cells in matrix.

Why I picked this question: “Shortest path” has become a “hot” question in interview. This might be because people use this feature a lot when they drive or find nearest restaurant! So I’d like to kick off the trilogy of “shortest path”.

Recommended:
Download source code
Java coding interview youtube series

Comments are closed