You are not using strict and warnings for starters. Next:
You should chomp it, otherwise $root will contain newline in the end.my $root= <>;
Oh, really?my %graph= %graph;
And this is why you should use strict, note $dist{$n}, shouldn't it be $dist{$n1}?$dist{$n2} = $dist{$n} + $graph{$n1}{$n2};
In reply to Re: what is wrong with my Dijkstram algorithm?
by zwon
in thread what is wrong with my Dijkstram algorithm?
by Michael Z.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |