跪求关于c语言多叉树添加节点的问题

[复制链接]
查看11 | 回复1 | 2009-5-6 12:21:09 | 显示全部楼层 |阅读模式
求一段代码。
我想建一个多叉树,每个节点都有一个类别,比如性别=男,性别=女。然后在我想要的节点下面再添加子女节点,比如在性别为男的节点下添加三个节点,年龄=大,年龄=中,年龄=小。。。请问如何在树中搜索出我想要的节点,并在其后面添加子女节点?
请大家多帮忙啊,这个作业周四要交了,试了无数次了,我都快被逼疯了。。。没多少分了,答案详细具体的话全部送出。

回复

使用道具 举报

千问 | 2009-5-6 12:21:09 | 显示全部楼层
数据结构:struct list{ /* other data */ int effectif_class_1; int effectif_class_2; struct list *parent; struct list *child[];}struct list * findNode(struct list *point){ int i; if(point->data == data)return point; i=0; while(point->child != NULL){if( (findNode(point->child)) == poi...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行