diff --git a/Dijkshtra.java b/Dijkshtra.java new file mode 100644 index 00000000..93c58d67 --- /dev/null +++ b/Dijkshtra.java @@ -0,0 +1,38 @@ +public static void main(String[] args) throws IOException { + Reader in=new Reader(); + int t1=in.nextInt(); + for(int gj=0;gjcmp){ + w[x][y]=cmp; w[y][x]=cmp; + } + } + Stack t=new Stack(); + int src=in.nextInt(); + for(int i=1;i<=n;i++){ + if(i!=src){t.push(i);}} + Stack p=new Stack(); + p.push(src); + w[src][src]=0; + while(!t.isEmpty()){int min=989997979,loc=-1; + for(int i=0;i