Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Test Cases

1 view
Skip to first unread message

Thayalan Sarath

unread,
Apr 9, 2001, 2:56:12 PM4/9/01
to
I just traced the test case answers for a depth search and the answer
given by exercise190 don't make sense. Both recursively and using a stack
i get a different print order. I am following the methodolgy given in
Prof. Chen's lecture notes. I mean i got a way for the stack and recursive
solutions to give the same output even though they DON"T HAVE TO (said in
Prof. Chen's notes) but then exercise 190 gives a completely different
print order.
Someone please clarify. thx.


Frank Van Bussel

unread,
Apr 9, 2001, 4:41:10 PM4/9/01
to Thayalan Sarath

Are you sure that you are treating the graph as undirected? Treating the
edges you get as directed edges will in most cases give you a different
traversal (most of the given graphs are not even connected then).

Obviously, you can use any number of orderings to do either DFS or BFS (or
even none; DFS will work if you visit a random unmarked neighbour). On the
other hand, it would be physically impossible for us to hand check
everybody's output to determine if it matched _some_ valid DFS. So try to
keep the output consistent with the autotest.

Frank


0 new messages