# Swap Nodes in Pairs

1. struct ListNode {
2.     int val;
3.     ListNode *next;
4.     ListNode(int x) : val(x), next(NULL) {}
5. };
6. class Solution {
7. public:
10.         while(NULL != *curNext && NULL != (*curNext)->next)
11.         {
12.             ListNode* temp = (*curNext)->next;
13.             (*curNext)->next = (*curNext)->next->next;
14.             temp->next = *curNext;
15.             *curNext = temp;
16.             curNext = &(*curNext)->next->next;
17.         }
19.     }

1. };

ListNode *swapPairs(ListNode *head) {
ListNode *first, *second, *temp;

}
else {
second = first->next;
temp = first;
while (first && second) {
temp->next = second;
first->next = second->next;
second->next = first;
temp = first;
first = first->next;
if (first != NULL) {
second = first->next;

}

}

}
}

#### Swap Nodes in Pairs -- LeetCode

2014-02-26 01:37:59

#### (Java)LeetCode-24. Swap Nodes in Pairs

2016-06-02 16:53:15

#### LeetCode 24 Swap Nodes in Pairs (C,C++,Java,Python)

2015-05-11 16:37:22

#### LeetCode24. Swap Nodes in Pairs简单到一次性通过

2016-02-02 21:01:22

#### [LeetCode] 024. Swap Nodes in Pairs (Medium) (C++/Python)

2015-03-05 14:39:27

#### LeetCode 24 Swap Nodes in Pairs（交换序列中的结点）（Linked List）

2015-11-12 18:43:57

#### 24. Swap Nodes in Pairs [easy] (Python)

2016-05-29 15:09:02

#### Swap Nodes in Pairs 交换链表的每两个节点

2018-05-31 11:17:11

#### lintcode-Swap Nodes in Pairs -451

2015-10-18 21:34:22

#### 【24】Swap Nodes in Pairs

2016-08-15 17:39:09