[面试] [反转链表] 三变量提头法

#include <iostream>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <bitset>
#include <list>
#include <map>
#include <set>
#include <iterator>
#include <algorithm>
#include <functional>
#include <utility>
#include <sstream>
#include <climits>
#include <cassert>
#define BUG puts("here!!!");

using namespace std;
const int N = 105;
struct Node {
	int num;
	Node* next;
};
Node* head;
Node* reverse(Node* head) {
	if(head == NULL) return NULL;
	Node* tmp = head;
	Node*p;
	while(tmp->next != NULL) {
		p = tmp->next;
		tmp->next = p->next;
		p->next = head;
		head = p;
	}
	return head;
}
int main() {
	return 0;
}

原文地址:https://www.cnblogs.com/robbychan/p/3787154.html