DS PTA
Kroenen_
这个作者很懒,什么都没留下…
展开
-
15.7-1 prim
#include #include #include #include using namespace std; const int maxn = 117; typedef struct GNode{ int arc[maxn][maxn]; int nv, ne; }*MGraph; struct{ int adv; //U中到当前元素顶点最近的点的名称原创 2017-11-03 23:19:04 · 122 阅读 · 0 评论 -
6.7-3求链表倒数第n项
求链式线性表的倒数第K项 1.建立双向链表 注意查询错误位置输出 2.考研题思路 定义两个指针a,b,都指向链表头节点,然后将b向后移k次,再将a,b同时向后移,当b到达链表末尾时a指向的那个节点值即是倒数第K项。注意特殊情况的考虑,比如链表总长度刚好等于K或者小于K等。 #include #include typedef struct node *ptrNode;转载 2017-09-25 14:30:37 · 331 阅读 · 0 评论