数据结构(C++版)(第二版)教学课件李根强第07章.pptVIP

  • 2
  • 0
  • 约3.04万字
  • 约 105页
  • 2019-10-08 发布于广东
  • 举报

数据结构(C++版)(第二版)教学课件李根强第07章.ppt

4.拓扑排序的算法实现 //本算法中采用图7-34所示的AOV网作示范 #includeiostream.h typedef int elemtype; const int n=5; //n表示图中顶点数 const int e=6; //e表示图中弧的数目 class link { public: elemtype data; link *next; }; class node { public: link a[n+1]; void creatlink3(node g ); void topsort (node g ); } ; void node::creatlink3( node g) //建立带入度的邻接表 { int i,j,k ; link *s ; for(i=1; i=n;i++) //建立邻接表头结点 { g.a[i].data=0; //入度值为0 g.a[i].next=NULL; } for(k=1; k=e;k++) { cout请输入一条弧:; cinij ; //输入一条弧 i,j coutendl; s=new lin

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档