<笔试><面试>C/C++单链表(最综合)最全工程从建立到相关函数实现

来源:互联网 发布:无法备案的域名 编辑:程序博客网 时间:2024/06/08 11:45

(1)打印链表 
(2)使用引用 定义别名的方法实现尾插 
(3)尾删 
(4)头插 
(5)头删 
(6)寻找data为x的结点 
(7)在pos处插入新结点 
(8)删除pos位置的结点 
(9)从尾到头打印链表 
(10)删除一个无头链表的非尾结点 
(11)在无头单链表的一个非头结点前插入一个结点 
(12)逆置链表 
(13)查找单链表的中间结点,要求只遍历一次链表 
(14)查找链表的倒数第K个结点,要求只遍历一次链表 
(15)约瑟夫环 
(16)单链表排序(冒泡) 
(17)判断链表是否有环 
(18)求链表环长度 
(19)找环入口 
(20)找环入口_链表相交法 
(21)判断两链表是否相交,求交点(假设链表不带环) 
(22)判断两链表是否相交,求交点(假设链表可能带环)


//**********SListNode.h****************#pragma once#ifndef __SLISTNODE_H__#define __SLISTNODE_H__//--------添加头文件-----------#include<stdio.h>#include<stdlib.h>#include<assert.h>//--------链表结构------------typedef int DateType;  //定义数据类型为 inttypedef int DataType;typedef struct SListNode{ DataType data; struct SListNode *next;}SListNode;//--------函数-------------void PrintNode(SListNode *&pHead);//打印链表void PushBack(SListNode* &pHead, DataType x);//使用引用 定义别名的方法实现尾插void PushBack_p(SListNode **ppHead, DataType x);void PopBack(SListNode* &pHead);//尾删void PushFront(SListNode* &pHead, const DataType x);//头插void PopFront(SListNode* &pHead);//头删SListNode* Find(SListNode* pHead, const DataType x);//寻找data为x的结点void Insert(SListNode* pos, const DataType x);//在pos处插入新结点void Erase(SListNode*&pHead,SListNode* pos);//删除pos位置的结点void Print_T_to_H(SListNode*&pHead); //从未到头打印链表void Del_N_tail(SListNode* pos);  //删除一个无头链表的非尾结点void InsertFront(SListNode*, const DataType x);  //在无头单链表的一个非头结点前插入一个结点void Turn(SListNode*&pHead);  //逆置链表SListNode* FindMidOnce(SListNode*& pHead);//查找单链表的中间结点,要求只遍历一次链表SListNode* FindLKOnce(SListNode* pHead, int K);//查找链表的倒数第K个结点,要求只遍历一次链表SListNode* Joseph(SListNode *&pos, int K); //约瑟夫环void BubbleSortNode(SListNode *&pHead); //单链表排序(冒泡)SListNode* IsRing(SListNode *&pHead); //判断链表是否有环int RingLength(SListNode *&pHead);//求链表环长度SListNode* RingEntry(SListNode *&pHead);//找环入口SListNode* RingEntry_Point(SListNode *&pHead);//找环入口_链表相交法//int _LengthNode(SListNode*& pHead);SListNode* Intersect(SListNode *&L, SListNode *&M);//判断两链表是否相交,求交点(假设链表不带环)SListNode* IntersectRing(SListNode *&L, SListNode *&M);//判断两链表是否相交,求交点(假设链表可能带环)#endif   //__SLISTNODE_H__//***********SListNode.cpp****函数实现*******#include"SListNode.h"SListNode *_BuyNode(DataType x)//开辟新结点{ SListNode *tmp = (SListNode *)malloc(sizeof(SListNode)); tmp->data = x; tmp->next = NULL; return tmp;}void PushBack_p(SListNode **ppHead, DataType x){ assert(ppHead); if (*ppHead == NULL) {  *ppHead = _BuyNode(x); } else {  SListNode *tail = *ppHead;  while (tail!=NULL)  {   tail = tail->next;  }  tail = _BuyNode(x); }}void PushBack(SListNode* &pHead, DataType x)//使用引用 定义别名的方法实现尾插{ //不需断言 if (pHead == NULL) {  pHead = _BuyNode(x); } else {  SListNode *tail = pHead;  while (tail->next != NULL)  {   tail = tail->next;  }  tail->next = _BuyNode(x); }}void PopBack(SListNode* &pHead)//尾删 { //不需断言 //注意 空、一个节点 、多个节点三种情况 if (pHead == NULL) {  printf("SListNode is NULL\n");  return; } if (pHead->next == NULL) {  free(pHead);  pHead = NULL; } else {  SListNode *tail = pHead;  while (tail->next->next != NULL)  {   tail = tail->next;  }  free(tail->next);  tail->next = NULL; }}void PushFront(SListNode* &pHead, const DataType x)//头插{ //无需断言 if (pHead == NULL) {  pHead = _BuyNode(x); } else {  SListNode *tmp = _BuyNode(x);  tmp->next = pHead;  //针对没有头结点的情况  pHead = tmp; }}void PopFront(SListNode* &pHead)//头删{ //不需断言 //注意 空、多个节点三种情况 if (pHead == NULL) {  printf("SListNode is NULL\n");  return; } else {  SListNode *head = pHead->next;  free(pHead);  pHead = head; }}SListNode* Find(SListNode* pHead, const DataType x){ assert(pHead); SListNode*tmp = pHead; while (tmp != NULL) {  if (tmp->data == x)   return tmp;  tmp = tmp->next; } printf("%d 不在此链表中\n", x); return NULL; }void Insert(SListNode* pos, const DataType x)//在pos后插入新结点{ if (pos == NULL) {  pos = _BuyNode(x); } else {  SListNode* tmp = _BuyNode(x);  tmp->next = pos->next;  pos->next = tmp; }}void Erase(SListNode*&pHead, SListNode* pos)//删除pos位置后面的一个元素{ //考虑 空、 首元结点、 非首元结点、 不存在pos位置 assert(pHead); assert(pos); if (pHead == pos) {  pHead = pHead->next;  free(pos); } SListNode* prev = pHead; while (prev) {  if (prev->next == pos)  {   prev->next = pos->next;   free(pos);   pos = NULL;   break;  }  prev = prev->next; } return;}void PrintNode(SListNode *&pHead){ SListNode *tmp = pHead; while (tmp) {  printf("%d->", tmp->data);  tmp = tmp->next; } printf("NULL\n");}void Print_T_to_H(SListNode*&pHead)//从尾到头打印链表{ //可用递归实现,以结点为空为结束条件 if (pHead != NULL) {  Print_T_to_H(pHead->next);  printf("%d ", pHead->data); }}void Del_N_tail(SListNode* pos) //删除一个无头链表的非尾结点{ //当为空、尾时不删除 //思路:转换为删除pos的下一个结点,删除之前把值传给pos结点 if (pos->next) {  pos->data = pos->next->data;  SListNode *tmp = pos->next;  pos->next = tmp->next;  free(tmp);  tmp = NULL; }}void InsertFront(SListNode*pos, const DataType x)  //在无头单链表的一个非头结点前插入一个结点{ //初步思路:在pos后插入元素,再与pos的值互换(若传入的是头结点则也可运行) //还能进行优化为:在pos后插入值为pos->data的结点,再将pos值变为x SListNode *tmp = _BuyNode(pos->data); tmp->next = pos->next; pos->next = tmp; pos->data = x;}void Turn(SListNode*&pHead)  //逆置链表{ //思路:从第二个开始顺次将结点放在头结点位置 //assert(pHead);//考虑到可能传入NULL时也合理,所以在这里不能使用断言assert if (pHead) {  SListNode*NewHead = pHead;  SListNode*cur = pHead;  while (cur->next)  {   SListNode*tmp = cur->next;   cur->next = tmp->next;   tmp->next = NewHead;   NewHead = tmp;  }  pHead = NewHead; }}SListNode* FindMidOnce(SListNode*&pHead)//查找单链表的中间结点,要求只遍历一次链表{ //思路:两个指针一快一慢,快指针走两步,慢指针走一步 assert(pHead); SListNode* fast = pHead; SListNode* slow = pHead; while (fast&&fast->next) {  slow = slow->next;  fast = fast->next->next; } return slow;}SListNode* FindLKOnce(SListNode*pHead, int K)//查找链表的倒数第K个结点,要求只遍历一次链表{ //思路:两个指针一快一慢,快指针先走K步,然后快慢指针一起走 assert(pHead); if (K <= 0)  return NULL; SListNode* fast = pHead; SListNode* slow = pHead; while (K--&&fast) {  fast = fast->next; } if (K >= 0) {  return NULL; } while (fast) {  fast = fast->next;  slow = slow->next; } return slow;}SListNode* Joseph(SListNode *&pos, int K) //约瑟夫环直到剩下最后一个结点,求最后一个结点{ assert(pos); if (K > 0) {  SListNode *tmp = pos;  while (1)  {   int count = K;   while (--count)   {    tmp = tmp->next;   }   if (tmp->next == tmp)    return tmp;   SListNode *cur = tmp->next;//删除tmp位置的结点,思路:pos与下一位置结点元素值进行交换后,删除下一结点   DataType Tmpcount = cur->data;   tmp->next = cur->next;   cur->data = tmp->data;   tmp->data = Tmpcount;   free(cur);  } } return NULL;}void BubbleSortNode(SListNode *&pHead)//单链表排序{ assert(pHead); SListNode *tail = NULL; int Bool = 0;  //若没有进行交换提前返回 while (tail!=pHead->next) {  Bool = 0;  SListNode *tmp = pHead;  SListNode *tmpnext = tmp->next;  while (tmp->next != tail)  {   if (tmp->data > tmpnext->data)   {    DataType x = tmp->data;    tmp->data = tmpnext->data;    tmpnext->data = x;    Bool = 1;   }   tmp = tmp->next;   tmpnext = tmpnext->next;  }   if (Bool == 0)// 已排好序提前返回   return;  tail = tmp; }}SListNode* IsRing(SListNode *&pHead) //判断链表是否有环,求相聚点(环上一点){ //判空、有、没有 //思路:两个指针从头开始一快(2步)一慢(1步),若最后可以相聚,则链表有环 if (pHead) {  SListNode *fast = pHead;  SListNode *slow = pHead;  while (fast&&fast->next)  {   fast = fast->next->next;   slow = slow->next;   if (slow == fast)    return fast;  }  return NULL; } return NULL;}int RingLength(SListNode *&pHead)//求链表环长度{ //先判断链表有环 //思路:从IsRing得到的点开始走一圈环,记录结点个数 if (pHead)//判空 {  SListNode* point = IsRing(pHead);  if (point != NULL)//无环情况  {   int count = 1;   SListNode *tmp = point->next;   while (tmp != point)   {    tmp = tmp->next;    count++;   }   return count;  } } return 0;}SListNode* RingEntry(SListNode *&pHead)//找环入口{ //判是否为空、有环 //思路:判断有环,找到快慢指针的相聚点,然后一个指针从聚点开始,一个从头开始,每次一步,相遇点就为入口节点 if (pHead)//判空 {  SListNode *tmp = IsRing(pHead);  if (tmp)//判有环  {   SListNode *cur = pHead;   while (cur!=tmp)   {    cur = cur->next;    tmp = tmp->next;   }   return cur;  }  return NULL; } return NULL;}int _LengthNode(SListNode*& pHead)//RingEntry_Point内部函数,求链表长度{ if (pHead) {  SListNode *tmp = pHead;  int count = 0;  while (tmp)  {   count++;   tmp = tmp->next;  }  return count; } return 0;}SListNode* RingEntry_Point(SListNode *&pHead)//找环入口_链表相交法{ //判是否为空、有环 //思路:在快慢指针相聚点截断,将环链表变为两个相交链表,因为相交链表尾部重合呈Y字型, //     求两个链表长度之差K,再令一个指针从长链表开始先走K步,令另一个指针从短链表头开始, //     两链表一起走,相遇点就为入口点 // //经过调试发现 还必须在返回之前将链表复原,不然会出现丢失链表结点的情况,应对函数进行修改 //在实现函数功能之后将环复原 // if (pHead)//判空 {  SListNode *tmp = IsRing(pHead);  if (tmp)//判有环  {   SListNode *cur = pHead;   SListNode *NewNode = tmp->next;   SListNode*tmp_fail = tmp;//将截断处保存   SListNode*tmp_head = NewNode;   tmp->next = NULL;//将环从tmp处截断   int c1 = _LengthNode(cur);   int c2 = _LengthNode(NewNode);   int minus = _LengthNode(cur) - _LengthNode(NewNode);   if (minus > 0)   {    while (minus--)    {     cur = cur->next;    }   }   else   {    int tmp = -minus;    while (tmp--)    {     NewNode = NewNode->next;    }   }   while (NewNode!=cur)   {    NewNode = NewNode->next;    cur = cur->next;   }   tmp_fail->next = tmp_head;//将原环修复   return cur;  }  return NULL; } return NULL;}SListNode* Intersect(SListNode *&L, SListNode *&M)//判断两链表是否相交,求交点(假设链表不带环){ //思路:若不带环,只有相交/不想交两种情况 // 与RingEntry_Point()函数方法相同: //     求两个链表长度之差K,再令一个指针从长链表开始先走K步,令另一个指针从短链表头开始, //     两链表一起走,相遇点就为入口点 if (L != NULL&&M != NULL) {  SListNode *cur = L;  SListNode *NewNode = M;  int c1 = _LengthNode(cur);  int c2 = _LengthNode(NewNode);  int minus = _LengthNode(cur) - _LengthNode(NewNode);  if (minus > 0)  {   while (minus--)   {    cur = cur->next;   }  }  else  {   int tmp = -minus;   while (tmp--)   {    NewNode = NewNode->next;   }  }  while (NewNode != cur&&NewNode != NULL&&cur != NULL)  {   NewNode = NewNode->next;   cur = cur->next;  }  if (NewNode == NULL || cur == NULL)   return NULL;  return cur; } return NULL;} SListNode* IntersectRing(SListNode *&L, SListNode *&M)//判断两链表是否相交,求交点(假设链表可能带环){ //思路:考虑全部情况:1、不带环 相交/不相交  2、带环 一条带环一条不带环/两条都带环(其中又分交点不在环上/交点在环上) //等函数见前篇 //区分是哪一种情况,分别实现 if (L != NULL&&M != NULL) {  if (!IsRing(L) && !IsRing(M))//不带环   return Intersect(L, M);  else if ((IsRing(L) && !IsRing(M)) || (!IsRing(L) && IsRing(M)))//一条带环一条不带环   return NULL;  else  {   //先求两链表的环入口点,若入口点一样,则为第5种情况否则是第4、6种情况   SListNode *re1 = RingEntry(L);   SListNode *re2 = RingEntry(M);   if (re1 == re2)//第5种情况 化为不带环相交链表问题   {    SListNode* m1 = IsRing(L);    SListNode*recover = m1->next;// 复原仿照RingEntry_Point()函数    m1->next = NULL;    SListNode*cur = Intersect(L, M);    m1->next = recover;    return cur;   }   else//第4、6种情况若其中一个环入口点在另一个环上,则为第6种情况,否则为第4种情况   {    SListNode *tmp = re1->next;    while (tmp != re1&&tmp != re2)     tmp = tmp->next;    if (tmp == re1)//第4种情况     return NULL;    printf("两链表带环,并且有两个交点\n");//第6种情况    SListNode *tmp1 = re1->next;    re1->next = NULL;    PrintNode(re1);    re1->next = tmp1;    return re2;   }  } } else  return NULL;}//***********test.cpp****************#define _CRT_SECURE_NO_WARNINGS#include"SListNode.h"void Test1()  //PushBack\PopBack{ printf("//Test1() PushFront/PopFront\n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 4); PrintNode(LL); PopBack(LL); PrintNode(LL); PopBack(LL); PrintNode(LL); PopBack(LL); PrintNode(LL); PopBack(LL); PrintNode(LL); PopBack(LL); PrintNode(LL);}void Test2()//PushFront\PopFront{ printf("//Test2() PushFront/PopFront\n"); SListNode *LL = NULL; PushFront(LL, 1); PushFront(LL, 2); PushFront(LL, 3); PushFront(LL, 4); PrintNode(LL); PopFront(LL); PrintNode(LL); PopFront(LL); PrintNode(LL); PopFront(LL); PrintNode(LL); PopFront(LL); PrintNode(LL); PopFront(LL); PrintNode(LL);}void Test3(){ printf("//Test3() Insert/Erase \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 4); PushBack(LL, 5); PrintNode(LL); Insert(LL, 0); PrintNode(LL); Insert(Find(LL, 5), 6); PrintNode(LL); Insert(Find(LL, 2), 3); PrintNode(LL); Erase(LL, Find(LL, 6)); PrintNode(LL); Erase(LL, Find(LL, 0)); PrintNode(LL); Erase(LL, Find(LL, 1)); PrintNode(LL); Erase(LL, Find(LL, 5)); PrintNode(LL); Erase(LL, Find(LL, 2)); PrintNode(LL); Erase(LL, Find(LL, 4)); PrintNode(LL); Erase(LL, Find(LL, 6));//当出现链表中不存在的元素Fine函数会返回NULL, //Erase函数第二个参数为NULL,断言assert检测到会返回错误 //在Erase(LL, Find(LL, 6));处插入断点 PrintNode(LL); Erase(LL, Find(LL, 3)); PrintNode(LL); free(LL);}void Test4()// Print_T_to_H/Del_N_tail{ printf("//Test4() Print_T_to_H/Del_N_tail \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 4); PrintNode(LL); Print_T_to_H(LL); printf("\n"); Del_N_tail(Find(LL,3));//中间结点 Print_T_to_H(LL); printf("\n"); Del_N_tail(Find(LL, 1));//首元结点 Print_T_to_H(LL); printf("\n"); Del_N_tail(Find(LL, 4));//尾结点 Print_T_to_H(LL);}void Test5()  //InsertFront/Turn{ printf("//Test5() InsertFront/Turn \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 5); PrintNode(LL); InsertFront(Find(LL,1),0); PrintNode(LL); InsertFront(Find(LL, 5), 4); PrintNode(LL); Turn(LL); PrintNode(LL);}void Test6()  //  FindMidOnce/FindLKOnce{ printf("//Test6() FindMidOnce/FindLKOnce \n"); SListNode *LL = NULL; SListNode *tmp = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 5); PrintNode(LL); printf("FindMidOnce = %d \n", FindMidOnce(LL)->data); tmp = FindLKOnce(LL, 0); printf("\n(找倒数第0个结点)\nFindMidOnce = "); PrintNode(tmp); tmp = FindLKOnce(LL, 1); printf("\n(找倒数第1个结点)\nFindMidOnce = "); PrintNode(tmp); tmp = FindLKOnce(LL, 4); printf("\n(找倒数第4个结点)\nFindMidOnce = "); PrintNode(tmp); tmp = FindLKOnce(LL, 5); printf("\n(找不存在的结点倒数第5个结点)\nFindMidOnce = "); PrintNode(tmp); }void Test7()// Joseph{ printf("//Test7() Joseph \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 4); PushBack(LL, 5); PushBack(LL, 6); PushBack(LL, 7); Find(LL, 7)->next = Find(LL, 1); printf("%d\n", Joseph(LL, 3)->data);}void Test8()//BubbleSortNode{ printf("//Test8() BubbleSortNode \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 6); PushBack(LL, 3); PushBack(LL, 7); PushBack(LL, 0); PushBack(LL, 3); PrintNode(LL); BubbleSortNode(LL); PrintNode(LL);}void Test9()  //IsRing/RingLength/RingEntry/RingEntry_Point{ printf("//Test9() IsRing/RingLength/RingEntry/RingEntry_Point \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 4); PushBack(LL, 5); PrintNode(LL); //printf("%d\n", _LengthNode(LL)); printf("\nRingLength = %d\n", RingLength(LL));//不是环 SListNode*tmp = RingEntry(LL); PrintNode(tmp); tmp = RingEntry_Point(LL); PrintNode(tmp); Find(LL, 5)->next = Find(LL, 5);//尾结点呈环 printf("\nRingLength = %d\n", RingLength(LL)); printf("RingEntry = %d\n", RingEntry(LL)->data); printf("RingEntry_Point = %d\n", RingEntry_Point(LL)->data); Find(LL, 5)->next = Find(LL, 3);//中间结点开始呈环 printf("\nRingLength = %d\n", RingLength(LL)); printf("RingEntry = %d\n", RingEntry(LL)->data); printf("RingEntry_Point = %d\n", RingEntry_Point(LL)->data);//由于函数实现时没有将断开的环闭合,导致丢失数据 //函数RingEntry_Point在此处将原链表破坏丢失元素5,所以在函数实现时必须将环复原 Find(LL, 5)->next = Find(LL, 1);//整个链表为环链表已不存在元素为5的结点 出现错误 所以在函数实现时必须将环复原 //整个链表为环 printf("\nRingLength = %d\n", RingLength(LL)); printf("RingEntry = %d\n", RingEntry(LL)->data); printf("RingEntry_Point = %d\n", RingEntry_Point(LL)->data);}void Test10(){ printf("//Test10() Intersect() \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 4); PushBack(LL, 5); PrintNode(LL); SListNode *MM = NULL; PushBack(MM, 1); PushBack(MM, 2); MM->next->next = LL->next->next->next; PrintNode(MM); SListNode *NN = NULL; PushBack(NN, 7); PushBack(NN, 8); PushBack(NN, 9); PushBack(NN, 0); PrintNode(NN); SListNode* c1 = Intersect(LL, MM); SListNode* c2 = Intersect(LL, NN); PrintNode(c1); PrintNode(c2);}void Test11(){ printf("//Test11() IntersectRing() \n"); SListNode *LL = NULL; PushBack(LL, 1); PushBack(LL, 2); PushBack(LL, 3); PushBack(LL, 4); PushBack(LL, 5); PrintNode(LL); SListNode *NN = NULL; PushBack(NN, 6);  PushBack(NN, 7); PushBack(NN, 8); PushBack(NN, 9); PushBack(NN, 0); PrintNode(NN); SListNode* c1 = IntersectRing(LL, NN);//第1种 PrintNode(c1); printf("\n"); SListNode *MM = NULL;//第2种 PushBack(MM, 0); PushBack(MM, 1); MM->next->next = LL->next; SListNode* c2 = IntersectRing(LL, MM); PrintNode(c2); printf("\n"); Find(LL, 5)->next = Find(LL, 3);//第3种 SListNode* c3 = IntersectRing(LL, NN); SListNode* c4 = IntersectRing(NN, LL); PrintNode(c3); PrintNode(c4); printf("\n"); Find(NN, 0)->next = Find(NN, 8);//第4种 SListNode* c5 = IntersectRing(NN, LL); PrintNode(c5); printf("\n"); SListNode* c6 = IntersectRing(MM, LL);//第5种 SListNode* c7 = IntersectRing(LL, MM); SListNode* tmp1 = c6->next; c6->next = NULL; PrintNode(c6); c6->next = tmp1; SListNode* tmp2 = c7->next; c7->next = NULL; PrintNode(c7); c7->next = tmp2; printf("\n"); Find(NN, 0)->next = Find(LL, 4);//第6种 SListNode* c9 = IntersectRing(NN, LL); SListNode* tmp3 = c9->next; c9->next = NULL; PrintNode(c9); c9->next = tmp3; SListNode* c10 = IntersectRing(LL, NN); SListNode* tmp4 = c10->next; c10->next = NULL; PrintNode(c10); c10->next = tmp4; printf("\n"); Find(LL, 5)->next = Find(LL, 1);//第6种 Find(NN, 0)->next = Find(LL, 4); SListNode* c11 = IntersectRing(NN, LL); SListNode* tmp5 = c11->next; c11->next = NULL; PrintNode(c11); c11->next = tmp5; SListNode* c12 = IntersectRing(LL, NN); SListNode* tmp6 = c12->next; c12->next = NULL; PrintNode(c12); c12->next = tmp6; printf("\n");}int main(){ //Test1(); //Test2(); //Test3(); //Test4(); //Test5(); //Test6(); //Test7(); //Test8(); //Test9(); //Test10(); Test11(); system("pause"); return 0;}


0 0