typedef struct _Tree
{
int data;
struct _Tree *first;
struct _Tree *second;
struct _Tree *thrid;
struct _Tree *fourth;
...
...
...
}Tree;
뭐 이렇게 해야되나
ㅠㅠ
typedef struct _Tree
{
int data;
struct _Tree *first;
struct _Tree *second;
struct _Tree *thrid;
struct _Tree *fourth;
...
...
...
}Tree;
뭐 이렇게 해야되나
ㅠㅠ
자식 2개이상 되는 것도 이진트리로 만들면 돼
c++이라면 vector<_Tree*> child; 쓰면 돼서 편한데. c로 짜야 한다면 링크드리스트 구현해야하지 않을까요
자식 개수가 정해져있는거라면 malloc으로 배열잡기 struct _Tree **child; 선언해놓고 child = (어쩌구저쩌구)malloc(저쩌구어쩌구);
struct Node{ int value; Node* left; Node* right; Node* sibling; }
값, 왼쪽, 오른쪽, 형제 노드(형제 노드는 오른쪽을 가리키게)
http://dblack.tk
커뮤니티 사이트 입니다 많은 이용 부탁 드립니다.