Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 编程/算法/API  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 树的遍历问题
pinkpig1982





发贴: 1
积分: 0
于 2005-12-05 17:12 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这几天一直在烦一个很烦的问题
有这样一个图,图在附件

根据这个图我用这样一个数组存储节点间的关系:
int[][] tempList = new int[13][2];
tempList[0] = {1,3};
tempList[1] = {3,6};
tempList[2] = {3,7};
tempList[3] = {3,8};
tempList[4] = {6,9};
tempList[5] = {6,10};
tempList[6] = {7,11};
tempList[7] = {7,12};
tempList[8] = {8,2};
tempList[9] = {9,2};
tempList[10] = {10,2};
tempList[11] = {11,2};
tempList[12] = {12,2};

希望根据这个数组print出下面的东西:
1();
int value3 = 3();
if(value3 ...)
{
int value6 = 6();
if(value6 ...)
{
9();
2();
}
else if(value6 ...)
{
10();
2();
}
}
else if(value3 ...)
{
int value7 = 7();
if(value7 ...)
{
11();
2();
}
else if(value7 ...)
{
12();
2();
}

}
else if(3 ...)
{
8();
}

这个图和print出来的东西只是举例,其它不同形状的图也要能按照这个规则print出来
我真是做了好久都做不出来!所以请各位帮个忙吧,小女子在这里谢过了!

abc.gif (167.8k)




话题树型展开
人气 标题 作者 字数 发贴时间
9292 树的遍历问题 pinkpig1982 1864 2005-12-05 17:12
7053 Re:树的遍历问题 justforfun 53 2005-12-06 06:46
6932 Re:树的遍历问题 ftang 345 2005-12-09 06:23
6683 Re:树的遍历问题 ranchgirl 56 2005-12-09 09:10
7182 Re:树的遍历问题 ftang 54 2005-12-09 23:39

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923