首页 > 编程知识 正文

如何制作家谱树,家谱管理系统c语言数据结构

时间:2023-05-06 16:46:36 阅读:165064 作者:3372

我有以下结构:

Member {

字符串第一名称;

字符串顺序名称;

Member[] children;

成员因子;

}

我必须用java实现这棵树;

有名称和成员的第二个名称。 我们需要找到从根到那个节点的方法。

有人能帮助你吗?

这就是我拥有的东西:

publiclistchildren=new ArrayList (;

公共成员father=null;

公共字符串second name=null;

公共字符串第一个名称=null;

公共成员(stringsecondname,String firstName ) )。

this.secondName=secondName;

this.firstName=firstName;

}

公共成员(stringsecondname,String firstName,Member father ) {

this.secondName=secondName;

this.firstName=firstName;

this.father=father;

}

公共列表获取标题(

return children;

}

publicvoidsetfather (成员因子)。

this.father=father;

Father.addchild(this;

}

公共语音地址(stringsecondname,String firstName ) )。

member child=new member (second name,firstName;

child.setfather(this;

this.Children.add(child;

}

公共void addchild (member child ) {

child.setfather(this;

this.Children.add(child;

}

公共字符串获取代码名称(

return this.secondName;

}

公共字符串获取悲伤的关键(() )。

return this.firstName;

}

publicvoidsetsecondname (字符串密码)。

this.secondName=secondName;

}

publicvoidsetprenume (string first name ) {

this.firstName=firstName;

}

公共布尔is root

return(this.father==null );

}

public void deleteFather

this.father=null;

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。