Queues have many uses. One use of a queue is that it can be used to help find the fastest way out of a maze! The queue is an integral part of a search that is more generally called a Breadth First Search. The idea is as follows. Given a starting point in a maze, travel to all places adjacent to it and mark these as being 1 step away from the start point. Then, for each of these spots that are 1 step away, try travelling to all adjacent spots that are not yet visited. Mark these as 2 spots away. Continue until one of the spots you mark is an exit! By hand, it’s quite easy to visually solve this problem. In order to write a program to do it for a 2D array maze, you need a queue that keeps track of each place you have reached that you haven’t yet tried to visit new places from. The queue is necessary because to get shortest distances, you must process each possible location in the order in which you arrived to them. In addition, as you travel, you should mark which places you’ve reached so far, so that you don’t try to travel to them again. This second part is critical! Without it, you’ll revisit some squares many, many times, resulting in a very slow algorithm.
Let’s run through an example by hand, showing what has to happen, visually in code, in both the queue and the 2D array that is storing all shortest distances. We initialize any unvisited square to -1 to indicate that it is in fact, unvisited. When we visit that square, we will update its value to the shortest distance to travel there.
Hi Sir,
I am ready to work for you.I have 8 years of experience in C/C++ , java . please see some of my works also check my reviews you will get better idea about my skill.I deliver quality work within time
frame. Please visit my profile once.
Thanks with regards,
Amit
I am very proficient in c, c++. I have 15 years c++ developing experience now, and I have worked for 5 years. My work is online game developing, and mainly focus on server side, the lauguage is c++ under linux os. So, programming in c++ is never a problem. I used c++ to make many great projects, for example, I made the tools which can convert java files to c++ with the same meaning, ofcourse garbage collection included. I made our own mobile game using c++, I even can show you the demo of client. Trust me, please let expert help you.
Hi, I am placing my bid on your project because I have read the requirements and I am confident enough with my Java skills. I am focused mostly on doing computer science homework here in freelancer.com and I would like to help you get this project done if you would give me the opportunity. I am a computer science professor and practitioner and this assignment is one of the fields that I teach very well so I can assure you an accurate result.
It's a very easy task.
I have intimate knowledge of breadth first search.
I can do it for you.
I can finish it in a little hours.
Looking forward to your reply.
I have done it so I can provide you the solution and explanation immediately.
I have degree in computer science and I have designed many algorithms, BFS is one of the basic one. I will give you the code directly but assist you step by step so you can understand it completely. However, I will make sure you can finish it on time. I will also provide several other sample cases to be tested with the program to ensure it will get full credit.
I am open for discussion about this project in the future in case you have any other question, even if the result has been delivered.
Have already written and tested it, so you can have it as soon as you want it.
As I don't know exactly what is expected I can modify it to meat your requirements if necessary.
note I'm in the uk so my current time is GMT +1 which you may want to bare in mind when communicating.