I have problem with dijkstra algorithm
I want to write it in c++ and can not describe it in c++ //

what is this dijkstra algorith. (i'm sorry if i am less informed about the topic)

Here is some pseudocode code

>how I can use stack and queue to find shortest path ?

It's called homework for a reason. You can use the stack and queue as defined in the standard template library. Go google.

## All 9 Replies

what is this dijkstra algorith. (i'm sorry if i am less informed about the topic)

Here is some pseudocode code

how I can use stack and queue to find shortest path ?

>how I can use stack and queue to find shortest path ?

It's called homework for a reason. You can use the stack and queue as defined in the standard template library. Go google. I have problem with dijkstra algorithm
I want to write it in c++ and can not describe it in c++ //

I will try to code it for you in the following days and i will post it on your thread hopefully.

I will try to code it for you in the following days and i will post it on your thread hopefully.

You do realize that the question was asked 1,5 years ago right? i did not realize that :(

``````shortestPath(in theGraph, in weight:WeightArray) {
// Finds the minimum-cost paths between an origin vertex (vertex 0)
// and all other vertices in a weighted directed graph theGraph;
// theGraph’s weights are nonnegative
Create a set vertexSet that contains only vertex 0;
n = number of vertices in the Graph;
// Step 1
for (v=0 through n-1)
weight[v] = matrix[v];
// Steps 2 through n
for (step=2 through n) {
Find the smallest weight[v] such that v is not in vertexSet;
for (all vertices u not in vertexSet)
if (weight[u] > weight[v]+matrix[v][u])
weigth[u] = weight[v]+matrix[v][u];
}
}
``````

Algorithm is above if u try to find this algorithm but i think nobody develops a code for u here. Because it seems like it's your homework. right?

Thank the gods you finally arrived to give us the answer to this perplexing problem.

and to think we were just getting ready to close this one out as "unsolved"

*whew*

(next time, please dont wait so long, mmmkay?)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.