Algorithm: Find the way in a maze.

My friends had an algorithm project: Finding a way to get out of a maze.

Maze is a 10×10 matrix, and 1 is wall, 0 is a route.
How can a program find the exit?

1. Easy way.
Create a temporary matrix(called array in programming), and record where the program has been.
When it needs to come back to it’s original place, the matrix is used.
Cons: If the matrix is huge, the program doubles its memory size.

2. Smart(efficient) way.
A browse() method visits all possible spots, and if needs to come back, it checks where it shouldn’t check.
For example, if a browse() method detected a way using “DOWN” and create another browse() method, this method cannot detect “UP” but ends there and return to original(parent) browse() method.
Pros: This prevents a browse() method to create a child method for back-tracking.
Uses much less memory space.

Advertisements

4 Responses to “Algorithm: Find the way in a maze.”

  1. Hi buddy!

    how are you doin? you found me at Ok jsp today –;
    btw, do you learn such cool Algorithm everyday there?

    Ive presented ITIL built on Jira( famous project management tool which is used at J-Boss project) in front of Director today.

    It was not bad but he checked something to be improved for the Presentation for General Director next week.

    of course, I need to speech new project’s plan in japanese. geeeee!

    in order to finish this presentation, I asked my co-work to help me. ^^;
    so It will be ok.

    oh it is already around 12’00 am time to go to sleep.
    see you !

  2. Hi, Mr. Jango.
    This algorithm question is from my friends’ summer class, and I was helping them out with my “Gorgeous” algorithm.
    Unfortunately they didn’t use this though. lol
    what is ITIL? I have no idea about high-level tech.
    The last one I experienced is Struts. a few years ago. -_-;;
    presenting a new project in Japanese? wow.. great.
    I had a couple presentation in my Physics class last semester, and I tried not to be so serious about the topic.
    but your case is different. right?
    I believe you will be good!

  3. >I tried not to be so serious about the topic.

    you were right! not to be serious is import to make presenting successful!
    how is the weather there? here Tokyo! every day is more than 35 celcious.
    I am totally melted –;

    have a nice day!

  4. >I tried not to be so serious about the topic.

    you were right! not to be serious is import to make presenting successful!
    how is the weather there? here Tokyo! every day is more than 35 celcious.
    I am totally melted –;

    have a nice day!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: