Hi,
I guess he is going by the assumption that the queries will be large
enough that precomputing the all-pairs shortest paths is better.
Anyways..mukesh..this is what you need..
In the place of your output
while(cin.get(c) && c!='\n')
{
cin.unget();
cin>>t1>>t2;
printf("From %d to %d :\n",t1,t2);
printf("\n");
printf("Total cost : %d\n",pathcost[t1-1][t2-1]);
printf("Path :");
i=0;
j=t1-1;
k=t2-1;
t=t2-1;
printf("%d",(j+1));
while(j!=k && i<3)
{
while(j!=pre[j][t])
{
t=pre[j][t];
}
printf("-->%d",(t+1));
j = t;
t = k;
i++;
}
printf("\n");
getchar();
}
printf("\n");
All the best [:)]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---