15-11-2012, 04:35 PM
DIJKSTRA’S ALGORITHM
DIJKSTRA’S ALGORITHM.docx (Size: 13.24 KB / Downloads: 27)
Algorithm
Step1: [Include all the header files]
Step2: Call allSelected( )
Step3: Call Shortpath( )
Step4: Access the functions from main
Step5: End
Algorithm For ALLSELECTED( )
Step1: Initialise i=0
Step2: Check whether i<max
Step3: Check whether Selected[i]=0
Return 0
Step4: Else Return 1
Step5: Return
Algorithm For SHORTPATH( )
Step1: Initialise i=0 , Check i<max
Distance[i]=INFINITE
Step2: Assign selected[current].distance[0]=0,
Current=0
Step3: While(!allSelected(Selected))
Perform(Selected[i]= =0)
Current=k
Selected[current]=1
Print k