反转整个链表

- 代码 - 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15- struct ListNode* ReverseList(struct ListNode* pHead ) {
 // write code here
 if(pHead==NULL){
 return NULL;
 }
 struct ListNode* pre=NULL;
 struct ListNode* cur=pHead;
 while(cur!=NULL){
 struct ListNode* temp=cur->next;
 cur->next=pre;
 pre=cur;
 cur=temp;
 }
 return pre;
 }
- 理解 - 让temp保存cur->next的地址
- pre第一次要为NULL
 
- 让
反转整个链表
      https://tsy244.github.io/2023/04/10/数据结构/反转整个链表/