我有一个以这种方式组成的树 n 元:
struct n_tree{
struct list *adj;
};
struct list{
struct n_tree *child;
struct list *next;
int key;
};
我如何搜索项目?我已经实现了这个功能,但它不起作用......谢谢!
struct list *find(struct list *root, int key){
if(root){
find(root->next,key);
if (root != NULL){
if(root->key == key){
return root;
}
else if(root->child != NULL){
return find(root->child->adj,key);
}
}
}
}