You are not logged in. Please login at www.codechef.com to post your questions!

×

DFS implementation

Does this implementation of DFS is correct or not .. and if not so could anyone correct it >:)

this is the link of it.

http://ideone.com/1sLMnw

asked 22 Jun '15, 17:57

ritwikenator's gravatar image

2★ritwikenator
4615
accept rate: 16%

edited 22 Jun '15, 17:59


ok no problem with,also look at my implementation it may helpful.
https://ideone.com/AGm2xe
link

answered 22 Jun '15, 19:39

pallesai's gravatar image

4★pallesai
176830
accept rate: 17%

edited 22 Jun '15, 19:45

It looks correct to me (assuming the graph has only five nodes). You should look at the recursive implementation as well(if you haven't). It is shorter and more intuitive than using stack but also generally a tad bit slower.

link

answered 22 Jun '15, 19:05

thezodiac1994's gravatar image

6★thezodiac1994
1.0k61122
accept rate: 16%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×727

question asked: 22 Jun '15, 17:57

question was seen: 937 times

last updated: 24 Jun '15, 15:19