1,192 views
1 votes
1 votes

2 Answers

5 votes
5 votes
The sequence  of node being traversed is..

0->1->2->4->5

or

0->4->5->1->2

so discovery time will be

d[0]->d[1]->d[2]->d[4]->d[5];

or

d[0]->d[4]->d[5]->d[1]->d[2]

so option a),b) d) seems to be conflicting...

anyhow d[i]<d[3]  i={0,1,2,4}

so option c) is answer
0 votes
0 votes

The discovery time of a node is when it is first time processed . ( if i have node a which is is processed first then assume i apply time 3 to it then all its descendants will have discovery  time >3 . Whereas finish time for a node(root )  will be largest , when its all all descendants have been processed and finished ) 

Whereas Finish time of a node is when all its descendants are also processed .

Since we are not given information about DFS start from which node. Assuming DFS is applied at node 0 

So if DFS start at node 0 

we can have following discover order a) 0-->1-->2-->4 --->5 (D[0]<d[1]<d[2]<d[4]<d[5])

or b)  0-->4-->5-->1--->2 (d[0]<d[4]<d[5]<d[1]<d[2])

Note that node 3 wont be discovered because no node has an outgoing edge to 3 ,

So we wont have discovery time and finish time for node 3 Hence option C is eliminated .

For Option a :If i consider d[0]<d[4] -- this condition is valid in both possible DFS sequences .

but the other part d[5]<d[4] is not valid in both possible DFS 

hence Option a is eliminated .

Now  consider option d :

here d[0]<d[1]<d[4] this is possible if  follow sequence a ( as stated above ) , But this is not followed if someone has opted b as DFS sequences Sames goes for the f[1]>f[4]-- but this is not valid for sequence a but it is valid for sequences b 

hence option c is elimnated 

Now for option b 

d[4]<d[5] is valid in both sequences . and even f[5]>f[4] is valid . So option B is correct one .

edited by

Related questions

1 votes
1 votes
2 answers
1
Parshu gate asked Nov 18, 2017
1,522 views