私はこのように構成されたツリーn-aryを持っています:
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);
}
}
}
}