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

#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;
}

posted @ 2013-01-25 21:58  小尼人00  阅读(149)  评论(0编辑  收藏  举报