while(S.Length() != N.Vertices())
 {
         int u = GetNext(N,S,d); // get a node with smallest d which is not already in S
         if(d[u] == infinity) return false;
         if(u == dest) return true;
         add u to S
         for(int v = 1; v <= N.Vertices(); v++)
                 if(if there is an edge (u,v) && v is not in S)
                 {
                         if(d[u] + N.Weight(u,v) < d[v])
                         {
				d[v] = d[u] + N.Weight(u,v);
				u is the previous node for v
			}
		}
}
•	Naive algorithm is O(n!)
•	Outer loop O(n)
•	GetNext O(n)
•	Inner loop O(n)
•	O(n) to see if v is in S
•	Inner loop = O(n)*O(n)
•	O(n)*(O(n)+O(n^2))
•	O(n)*(O(n^2))
•	O(n^3)
•	Even though our algorithm is O(n^3). Inner loop can be reduced to O(n), GetNext can be reduced to O(log n). So a better implementation can be done in 
•	O(n)*(O(log n)+O(n))
•	O(n)*(O(n))
•	O(n^2)
•	What we did just now is greedy algorithm?
•	Greedy means you use local information and make decisions based on that.
•	Doesn’t always work when the global solution is obtained. But in some cases good local strategy is good global strategy.
•	We are going to look at the next strategy divide and conquer.