From 8426d22e8105064dac7b462d229ae55ebd3d10ce Mon Sep 17 00:00:00 2001 From: Mayank Kumar Jha Date: Mon, 24 Apr 2017 19:13:31 +0530 Subject: [PATCH] Add files via upload --- Dijkshtra.java | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 Dijkshtra.java 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