Topic: 关于非递归的图的深度优先算法

  Print this page

1.关于非递归的图的深度优先算法 Copy to clipboard
Posted by: Linace
Posted on: 2005-12-04 09:24

题目:非递归的图的深度优先算法
利用栈实现图的非递归深度优先算法
要求:能够正确的打印出图的深度优先遍历结果

老师让我们自己做,不懂的上网找资料,好难啊...希望大家能帮帮我...

2.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-12-04 10:25

Write recursive 深度优先算法 first, and make it work as required.

Then figure out how to change it to non-recursion.

This would be my strategy to do such things.

If you understand the first one thoroughly, then the second would be easy too.

If you don't, then you need to read a book, most books will tell you how to understand/do it.

3.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-12-04 10:27

If you expect someone will do it for you, I think you probably expect too much...

If you wait, then you waste your own time...

Sorry to tell you the truth...

4.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: Linace
Posted on: 2005-12-04 11:32

THX,I think i would do something useful instead of wasting my time ^ ^

5.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: Linace
Posted on: 2005-12-04 11:34

ANY good website ?

6.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: justforfun
Posted on: 2005-12-06 06:48

I sent you a message.
How may I help you?

7.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: Linace
Posted on: 2005-12-14 12:20

I still can' finish it....my two parters did do nothing...I have to do all the things~!!!
Delphi....Jbuilder..Oracle...OMG~!! Any people can help me...?THX!!!

8.Re:关于非递归的图的深度优先算法 [Re: gongshi] Copy to clipboard
Posted by: justforfun
Posted on: 2005-12-15 06:22

gongshi wrote:
If you expect someone will do it for you, I think you probably expect too much...

If you wait, then you waste your own time...

Sorry to tell you the truth...


So true!!!

9.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: haoshuoqi
Posted on: 2005-12-15 11:12

我是第一次在这里发贴也是个java初学者。如有不对之处望大家指出。
我的想法是:
首先从一个结点开始,依次将此结点所有的邻接结点压栈
while(栈不为空)
{
a=pop( );
if(a有邻接结点)
{
再将所有邻接结点压栈;
}
else
{
输出结点a的数据;
}
}

10.Re:关于非递归的图的深度优先算法 [Re: haoshuoqi] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-12-15 12:45

haoshuoqi wrote:
我是第一次在这里发贴也是个java初学者。如有不对之处望大家指出。
我的想法是:
首先从一个结点开始,依次将此结点所有的邻接结点压栈
while(栈不为空)
{
a=pop( );
if(a有邻接结点)
{
再将所有邻接结点压栈;
}
else
{
输出结点a的数据;
}
}


Wrong, sorry to tell you! You try to use BFS way, change queue to stack. It will not work...

My guess is you don't know what is DFS...

11.Re:关于非递归的图的深度优先算法 [Re: gongshi] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-12-15 12:46

gongshi wrote:
Write recursive 深度优先算法 first, and make it work as required.

Then figure out how to change it to non-recursion.

This would be my strategy to do such things.

If you understand the first one thoroughly, then the second would be easy too.

If you don't, then you need to read a book, most books will tell you how to understand/do it.


This is the right way to do it, but nobody listens...
Sign!

12.Re:关于非递归的图的深度优先算法 [Re: Linace] Copy to clipboard
Posted by: cjyzpcl
Posted on: 2005-12-29 09:59

google first,ok?
既会英语又会中文的就是比连英语4级都要考n次的人了不起。


   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