Double link list


Double link list

#include<stdio.h> #include<stdlib.h> struct node { int Data; struct node * left; struct node * right; }; Insert_node(struct node **head, struct node ** tail, int num){ struct node * Search; struct node * tmp; tmp = (struct node *)malloc( 1*sizeof(struct node)); tmp->Data = num; tmp->left = NULL; tmp->right = NULL; if(*head == NULL){ //head가 비어있을때 *head = tmp; *tail = tmp; }else{ printf("< %d | %d | %d > - ",Search->left,Search,Search->right); Search = *head; while(1){ if(Search->right == NULL)break; Search=Search->right; } Search->right = tmp; tm..........



원문링크 : Double link list