#include "stdafx.h"
void MINDIST(int s[],int dist[]);
{
int temp=100000 , i, w = 2;
for(i = 2;i <= n; i++)
{
if(s[i] == 0 && cost[i] < temp)
{
temp = s[i];
w = i;
}
}
return w;
}
void SEARCH_VER(int s[],int dist[],int u)
{
}
SHORTEST_PATH(int cost[][n],int v,int n,int dist[],int path[])
{ int i,w,u,count,pos[n];
for(i=0;i<n;i++)
{ s[i]=0;
dist[i]=cost[v][i];
path[i][0]=v;
pos[i]=0;
}
s[v]=1;
count=1;
while(count<n)
{ u=MINDIST(s,dist);
s[u]=1;
path[u][++pos[u]]=u;
count++;
while(1)
{ if((w=SEARCH_VER(s,dist,u))==-1)
break;
else{
if(dist[u]+cost[u][w]<dist[w])
{ dist[w]=dist[u]+cost[u][w];
for(i=o;i<pos[u];i++)
path[w][i]=path[u][i];
}
}
}
}
}
int main(int argc, char* argv[])
{
printf("Hello World!\n");
return 0;
}
中间很长那段不要改 参数什么的都不要改;
这是我的作业。做不来了。求大神们帮忙~~
这个是北京航空航天大学的数据结构 唐发根教授版本的 最短路径问题。
MINDIST(s,dist) SEARCH_VER(s,dist,u)不要改~~
大神们 求求你们了、帮帮小弟吧。中间那段很长的代码估计有错。。