#include <iostream>
using namespace std;
typedef struct LinkNode
{
int id;
struct LinkNode *Next;
}Node;
Node * createLink(Node a[],int n)
{
Node *head=a;
for(int i=0;i<n-1;i++)
{
a[i].Next=&a[i+1];
}
a[n-1].Next=NULL;
return head;
}
Node * reverse_linkList(Node *pHeader)
{
if(pHeader == NULL)
{
cout<<"NULL point"<<endl;
}
Node *pPre=NULL;
Node *pCurrent=pHeader->Next;
Node *pNext=NULL;
while( pCurrent != NULL )
{
pNext=pCurrent->Next;
pCurrent->Next=pPre;
pPre=pCurrent;
pCurrent=pNext;
}
pHeader->Next=pPre;
return pHeader;
}
int size_LinkList(struct LinkNode *pHeader)
{
if(pHeader==NULL)
{
return -1;
}
struct LinkNode *pCurre
链表的翻转
最新推荐文章于 2025-06-07 15:52:56 发布