#include #include struct node { int data; struct node *next; struct node *prev; }; struct node* head = 0; void addToDLL(int n) { struct node* cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = n; cur->next = 0; cur->prev = 0; if (head == 0) { head = cur; return; } { //끝을 찾는다 struct node* temp = head; while (temp->next != 0) { temp = temp->next; } temp->next = cur; cur->prev = temp..
#include #include struct node { int data; struct node *next; struct node *prev; }; struct node* head = 0; void addToDLL(int n) { struct node* cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = n; cur->next = 0; cur->prev = 0; if (head == 0) { head = cur; return; } { //끝을 찾는다 struct node* temp = head; while (temp->next != 0) { temp = temp->next; } temp->next = cur; cur->prev = temp..
#include #include struct node { int data; struct node *next; struct node *prev; }; struct node* head = 0; void addToDLL(int n) { struct node* cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = n; cur->next = 0; cur->prev = 0; if (head == 0) { head = cur; return; } { //끝을 찾는다 struct node* temp = head; while (temp->next != 0) { temp = temp->next; } temp->next = cur; cur->prev = temp..
#include #include struct node { int data; struct node *next; struct node *prev; }; struct node* head = 0; void addToDLL(int n) { struct node* cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = n; cur->next = 0; cur->prev = 0; if (head == 0) { head = cur; return; } { //끝을 찾는다 struct node* temp = head; while (temp->next != 0) { temp = temp->next; } temp->next = cur; cur->prev = temp..
// Singly Linked List #include #include int in1, in2; //node 구조체정의 struct node { int data; struct node *next; }; struct node* head = 0; struct node* head2 = 0; //sLL에 추가하는함수 void addToSLL(int data) { struct node *cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = data; cur->next = 0; //1.SLL이 empty if (head == 0) { head = cur; return; } //2 else //2.1끝을찾자 //2.2끝에 붙이자 { struct node..
// Singly Linked List #include #include int in; //node 구조체정의 struct node { int data; struct node *next; }; struct node* head = 0; //sLL에 추가하는함수 void addToSLL(int data) { struct node *cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = data; cur->next = 0; //1.SLL이 empty if (head == 0) { head = cur; return; } //2 else //2.1끝을찾자 //2.2끝에 붙이자 { struct node* lastnode = head; while (last..
// Singly Linked List #include #include int in; //node 구조체정의 struct node { int data; struct node *next; }; struct node* head = 0; //sLL에 추가하는함수 void addToSLL(int data) { struct node *cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = data; cur->next = 0; //1.SLL이 empty if (head == 0) { head = cur; return; } //2 else //2.1끝을찾자 //2.2끝에 붙이자 { struct node* lastnode = head; while (last..
#include #include //node 구조체정의 struct node { int data; struct node *next; }; struct node* head = 0; //sLL에 추가하는함수 void addToSLL(int data) { struct node *cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = data; cur->next = 0; //1.SLL이 empty if (head == 0) { head = cur; return; } //2 else //2.1끝을찾자 //2.2끝에 붙이자 { struct node* lastnode = head; while (lastnode->next != 0) { lastnode = ..