D
Davy
My program deal with a several level tree with several branchs. The
amount of branchs from father node is not known. So I want to creat a
tree with dynamic branchs.
Now I use the structure:
typedef struct gnodes
{
int level; //tree level
struct gnodes* pfather;
struct gnodes* pbrother;
struct gnodes* pchild;
struct gnodes* puncle;
} gnode;
The child pointer link one by one form a chain, something like:
Father(i)->Child(1)->Child(2)->...->Child(n-1)->Child(n).
But I can not search child randomly.
How to design a better structure?
Any suggestions will be appreciated!
Best regards,
Davy
amount of branchs from father node is not known. So I want to creat a
tree with dynamic branchs.
Now I use the structure:
typedef struct gnodes
{
int level; //tree level
struct gnodes* pfather;
struct gnodes* pbrother;
struct gnodes* pchild;
struct gnodes* puncle;
} gnode;
The child pointer link one by one form a chain, something like:
Father(i)->Child(1)->Child(2)->...->Child(n-1)->Child(n).
But I can not search child randomly.
How to design a better structure?
Any suggestions will be appreciated!
Best regards,
Davy