473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Rat in a maze problem

NK
Rat in a Maze pblm can be solved using Stack data structure but
shortest possible path can't be found using it(but we can found a
possible path).To find shortest possible path without calculating
length of path which data struc. should be used .plz also describe
algo to solve it.
we can find all possible path using Stack..... then calculate length
of each possible path and find shortest one but its very time and
space consuming soln.

Thanks
NK

Jun 28 '07 #1
4 6970
NK wrote:
Rat in a Maze pblm can be solved using Stack data structure but
shortest possible path can't be found using it(but we can found a
possible path).To find shortest possible path without calculating
length of path which data struc. should be used .plz also describe
algo to solve it.
we can find all possible path using Stack..... then calculate length
of each possible path and find shortest one but its very time and
space consuming soln.
a) This is not a language question but an algorithm question. You are better
off in a group like comp.programming. Once you run into trouble wording the
solution in C++, this news group would be appropriate.

b) The problem sounds like homework. People will be more inclined to help
you if they can see that you made an honest effort to solve it yourself.

c) Your problem looks like finding shortest distances in graphs (possibly
with edged of lengths != 1). Read up on graph algorithms (a library is your
friend, if all else fail, there is Google). You are bound to find tons of
ideas. Also, the problem would benefit from a little clarification: are you
interested in the shortest path between two particular points or do you
want to compile a shortest distance table for the whole graph?
Best

Kai-Uwe Bux
Jun 28 '07 #2
On 2007-06-28 08:25, NK wrote:
Rat in a Maze pblm can be solved using Stack data structure but
shortest possible path can't be found using it(but we can found a
possible path).To find shortest possible path without calculating
length of path which data struc. should be used .plz also describe
algo to solve it.
we can find all possible path using Stack..... then calculate length
of each possible path and find shortest one but its very time and
space consuming soln.
Please, try to write the whole words instead of a lot of pblms and plz,
it makes your post much harder to read an it does not save you any
significant amount of time.

Anyway, it sounds to me like a general shortest path problem, and there
are a number of ways to solve these, use google.

--
Erik Wikström
Jun 28 '07 #3
NK wrote:
Rat in a Maze pblm can be solved using Stack data structure but
shortest possible path can't be found using it
I don't think that's true, unless you mean a "pure" stack which
has *only* the operations "push" and "pop" and no random acccess.

You should use google. Try with "breadth first".
Jun 28 '07 #4
NK wrote:
Rat in a Maze pblm can be solved using Stack data structure but
shortest possible path can't be found using it(but we can found a
possible path).To find shortest possible path without calculating
length of path which data struc. should be used .plz also describe
algo to solve it.
we can find all possible path using Stack..... then calculate length
of each possible path and find shortest one but its very time and
space consuming soln.

Thanks
NK
understanding graph shortest path algorithm + boost::graph = win
Jun 29 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Bernard Fields | last post by:
Greets, all. As the title suggests, I'm trying to make a maze. Specifically, it's a top-down, 2-d maze, preferably randomly generated, though I'm willing to forego that particular aspect as...
2
by: Roger Douglass | last post by:
I've been working on this program for school and I just about got it before I had to turn it in. Here's my final code on it. I didn't finish it, but I think I'm pretty close. M is the starting...
57
by: Xarky | last post by:
Hi, I am writing a linked list in the following way. struct list { struct list *next; char *mybuff; };
1
by: daneshjo | last post by:
Hi im an IT student.I have registered as a member of this site recently.I have a question about the solution of maze program. I want to write maze program in c++ .I want to solve the maze class...
1
by: ranajoy | last post by:
I have a C++ problem that i just can not get right. I has been driving me crazy for quite some time. The problem is as follows : Numbers have been randomly inputed into an integer 2D array by...
8
boxfish
by: boxfish | last post by:
Hi everyone, I'm working on a 3d maze game, and I just messed up the classes so it won't compile, and I need help sorting it out. There's a class Maze, whose members are, among other things, a list...
5
by: Brosert | last post by:
I am writing (or trying to) a small program to draw a maze, that can then be traversed by a user. I have set up a grid of squares that can be either present (blocking the path) or not (allowing the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.