From 780b580e08fc5997f245b8f7de6641488650a4b2 Mon Sep 17 00:00:00 2001 From: Rohithmohan255 <44532562+Rohithmohan255@users.noreply.github.com> Date: Sun, 28 Oct 2018 06:47:21 +0530 Subject: [PATCH] dijkstra's algorithm implemented --- dijkstra.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 dijkstra.cpp diff --git a/dijkstra.cpp b/dijkstra.cpp new file mode 100644 index 0000000..6898ab7 --- /dev/null +++ b/dijkstra.cpp @@ -0,0 +1,52 @@ +#include +#include /*Used for INT_MAX*/ +using namespace std; +#define vertex 7 /*It is the total no of verteices in the graph*/ +int minimumDist(int dist[], bool Dset[]) /*A method to find the vertex with minimum distance which is not yet included in Dset*/ +{ + int min=INT_MAX,index; /*initialize min with the maximum possible value as infinity does not exist */ + for(int v=0;v