red_coder's blog

By red_coder, 11 years ago, In English

hey guys here is a simple SPOJ Problem based on Dijikstra Algo. But i am not able to understand why am i getting wrong answer. Here is my CODE. Can somebody tell me where am i getting wrong.

  • Vote: I like it
  • -19
  • Vote: I do not like it

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

lol, maybe you need to use Dijkstra with a priority queue. It can help.

  • »
    »
    11 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    NO dude, the method i have used is correct, at each step i am trying to find the node with lowest key and then hold it and make it 'marked'.

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

you have static arrays and you need to enter a default size.

»
11 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Done finally :)