Backtracking Algorithm:rat in Maze

Source: Internet
Author: User

Sept. 10, 2015

Study again the back tracking algorithm using recursive solution, rats in maze, a classical problem. Made a few of mistakes through the practice, one is what do you use the dimension array, another one are that "not all return PA" Th returns value ", not so confident this" return false "at the end of the function.

Relive the algorithmic questions that were done two years ago, Rat in Maze, ashamed of himself! Two years ago the practice, without any reference to the page information, there is no algorithm discussion, try to improve. Feel the gap, this exercise, emphasis on the algorithm can be back out. Step-by-step writing to find a few errors. Two-dimensional array is unfamiliar, delayed for more than 10 minutes; In addition, it is, "return false" in the last sentence of the recursive function, first forget. In short, this classic topic, 10 minutes cannot write out; Requires two arrays, boundary condition detection, a little impression.

Here is my favorite blogs about this problem:




Julia ' s C # pratice:


And then, try-to-find more discussion about the problem, came cross blogs to challenge my analysis skills. Search Google, find a very deep Web page, after watching, experience the code, feel a few levels higher than their own level.



More code to read and then play:


and C # Practice:


Backtracking Algorithm:rat in Maze

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.