1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <bits/stdc++.h>
LinkedList* Concatenate(LinkedList* plist1, LinkedList* plist2){
if(plist1->head->next == NULL) return plist2;
else if(plist2->head->next == NULL) return plist1;
else{
Node* cur = plist1->head->next;
while(cur->next != NULL){
cur= cur->next;
}
cur->next = plist2->head->next;
free(plist2->head);
return plist1;
}
}
void Reverse(LinkedList *plist){
Node* prev = NULL, *cur = NULL;
Node*next = plist->head->next;
while(next != NULL){
prev = cur;
cur = next;
next = next->next;
cur->next = prev;
}
plist->head->next = cur;
}
|
cs |
'[자료구조론] - Data Structure > [Concept]' 카테고리의 다른 글
DoubleLinkedList (0) | 2020.10.19 |
---|---|
CircularList (0) | 2020.10.19 |
List (0) | 2020.10.13 |
Queue 구현 (0) | 2020.10.06 |
[자료구조론] Recursion (0) | 2020.09.29 |