Can you use Dijkstra's algorithm if there is a negative weight so long as there are no cycles?

You don't make any topological sort in the original algorithm. But in the case of an a-cyclic graph, then you can decrees the running time to O(V) (while the original running time is O(|V|*log(|V|)). The reason is that you sort in O(|V|) time, and then you can use that order, and don't need any heap (or priority queue).

So the over all time decreases to O(|V|).

Dijkstra's algorithm doesn't appear to require a topological sort. Perhaps doing so avoids a bug you have in your implementation.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions