c**********e 发帖数: 2007 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: Depth-First-Search
发信站: BBS 未名空间站 (Sun Jan 1 21:59:42 2012, 美东)
In the following graph, with starting point 0, what is the order of DFS
traversal?
0
/ \
1 2
/
3
We use a stack for DFS visit. The problem is, is the visit order the order each node is pushed into the stack, or the order each node is popped from the stack. | X****r 发帖数: 3557 | 2 Both. They are called pre-ordering and post-ordering, corresponsively.
Usually the former is implied.
【在 c**********e 的大作中提到】 : 【 以下文字转载自 JobHunting 讨论区 】 : 发信人: careerchange (Stupid), 信区: JobHunting : 标 题: Depth-First-Search : 发信站: BBS 未名空间站 (Sun Jan 1 21:59:42 2012, 美东) : In the following graph, with starting point 0, what is the order of DFS : traversal? : 0 : / \ : 1 2 : /
|
|