struct linknode{
int val;
linknode* next;
}
void reverselinklist(linknode* root){
if(nullptr==root)return;
linknode* pre=nullptr,cur=root->next;
while(cur){
cur->next=pre;
pre=cur;
cur=pre->next;
}
root->next=pre;
}
2021-11-07翻转链表(带头结点)
最新推荐文章于 2024-07-25 17:45:03 发布