/*struct ListNode {int val;struct ListNode *next;ListNode(int x) :val(x), next(NULL) {}};*/class Solution {public: ListNode* ReverseList(ListNode* pHead) { if (pHead == NULL) return NULL; ListNode* head = pHead; pHead = pHead->next; head->next = NULL; while (pHead) { ListNode *next = pHead->next; //头节点不是空数据域吗? pHead->next = head; //这里是用头插法把头节点和空数据域一直顶到最后面了吗? head = pHead; //变成 3->2->1->head ? pHead = next; } return head; }};