CS
-
[자료구조] Linked List 구현CS/자료구조 2022. 8. 4. 07:09
Single Linked list 를 값을 담는 data와 다음 Node를 가르키는 pointer 변수인 next를 가지는 Class를 Node로 생각하자. class Node { public : int data; Node* next; }; Linked list에 head ,second , third라는 Node를 가지고 순회하는 예제. int main() { Node* head = NULL; Node* second = NULL; Node* third = NULL; head = new Node(); second = new Node(); third = new Node(); (*head).data = 1; (*head).next = second; head->data = 1; head->next = secon..