Answer the question
In order to leave comments, you need to log in
How to calculate the shortest path between two points using a matrix of numbers?
I welcome everyone.
I am writing the so-called Lee Algorithm (aka unary / wave search).
In short, the essence is as follows:
We fill the matrix with numbers, moving in a wave from point A to point B.
Example:
In general, I managed to write a function that could fill the matrix in such a way. I used recursive calls for left/right/top/bottom positions and populated the array itself. But the question is: how can I calculate the shortest path now?
PS: I wrote Java code, but it doesn't matter. So you can give an example in any language (but preferably C-like or python).
Answer the question
In order to leave comments, you need to log in
Starting from the end point, you just always go towards the smallest number.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question