728x90 c언어 이진 트리 순회1 C언어 - 이진 트리, 이진 탐색 트리 구현 (binary tree, binary search tree) 코드 //binary search tree #include #include typedef struct node { int data; struct node* left; struct node* right; }node; node* root; node* insert(node* root,int data) { if(root == NULL) { root = (node*)malloc(sizeof(node)); root->right = root->left = NULL; root->data = data; return root; } else { if(data data) root->left = insert(root->left,data); else root->right = insert(root->right,dat.. 2021. 3. 5. 이전 1 다음 728x90