Pretty no... because I can't understand the "Grid" and "Queue q".
Pretty no... because I can't understand the "Grid" and "Queue q".
Need help, it's beyond my ability and experience now,,, maybe i should begin from a algorithm book?
As a hobby programmer only, I don't fully understand the reason for this algorithmic solution. I understand the data structures, but I don't understand why they're a good fit for this.
That font in the algo, looks a lot like Knuth, doesn't it?
I believe you have two alternatives:
1) Using the descripition provided, solve the problem yourself BY HAND (with paper and pencil). If you can't solve it yourself using the description provided, you'll have a hell of a time trying to code up a program that will solve it.
By doing that, you may find an easier (perhaps less computationally efficient) way, to solve the program, with code. With all the advances in computer hardware, the efficiency may not make a difference. So what if it takes an extra 0.12 seconds of run-time?
2) Consult other algorithm books and see if they have anything either simpler and easier to understand, or perhaps provide a functional example of a program snippet.
Naturally, Google is your friend on this.