旅行售货员问题c源代码及运行结果.docxVIP

  • 2
  • 0
  • 约3.73千字
  • 约 8页
  • 2019-11-06 发布于广东
  • 举报
〃源代码: #include stdio.h #include malloc.h #define NoEdge 1000 struct MinHe叩Node { int lcost; //子树费用的下界 int cc;〃当前费用 int rcost; //x[s:n-l J中顶点最小出边费用和 int s; 〃根节点到肖前节点的路径为x[0:s] int *x; 〃需要进一步搜索的顶点是〃x「s+ l:n-l] struct MinHeapNode *next; 1; intn;//图G的顶点数 int **a; 〃图G的邻接矩阵 //int NoEdge; //图G的无边标记 int cc;〃当前费用 int bestc; //当前最小费用 MinHeapNode* head = 0; /*堆头*/ MinHeapNode* lq = 0; /*堆第一个元素*/ MinHeapNode* fq = 0; /*堆最后一个元素*/ int DeleteMin(MinHeapNode*E) { MinHeapNode* tmp = NULL; tmp = fq; // w = fq-weight; E = fq; if(E == NULL) return 0; head-next = fq-next; /*一定不能丢了链表头*/ fq = fq-next; // free(tmp);

文档评论(0)

1亿VIP精品文档

相关文档