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:

1. http://www.geeksforgeeks.org/backttracking-set-2-rat-in-a-maze/

2. http://algorithms.tutorialhorizon.com/backtracking-rat-in-a-maze-puzzle/

3. https://www.cs.bu.edu/teaching/alg/maze/


Julia ' s C # pratice:

Https://github.com/jianminchen/AlgorithmsPractice/blob/master/RatInAMaze_BackTracking.cs

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.

Http://blogs.msdn.com/b/mattwar/archive/2005/02/03/366498.aspx

Http://blogs.msdn.com/b/mattwar/archive/2005/02/11/371274.aspx

More code to read and then play:

Http://www.evercrest.com/ext/CheeseAppropriator.cs

and C # Practice:

Https://github.com/jianminchen/AlgorithmsPractice/blob/master/MousingAround.cs

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: info-contact@alibabacloud.com 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.