GATE CSE
First time here? Checkout the FAQ!
x
+3 votes
82 views

asked in Programming by Veteran (20.3k points)   | 82 views
a and c ??
yes gabbar ryt
but i have doubt there in 1 option that when we explore till a,b,c,f,g now after  wards stack contain two element ,top element as e and bottom element as d so how we first print d and than after e  as e should be printed first where i am going wrong ?? plz clarify ?? or post ur snapshot using showing stack enteries  .

Option A.

 

now see adjacent of a which are b and d we take choice as  b 

same procedure repeats...

so stack having a b c f g .... now here g having  only one choice d and d having a,b,e choices from which a,b already visited...so e....

when there is loop we have to pop and again check for adjacent of element that is in case of option C.

 

Only 1. and 3.

They are asking about Traversal.

In 3rd Option: c->e->d->g->f-> after that we will back to f->g->d and then d->b->a.

So 3 is also right.

2 Answers

+2 votes
Best answer
i am getting option A and C are correct.

in C option after f  we will back to f->g->d and then d->b->a

therefore option C is right and remaining options B and D are incorrect because c can not occur just after d and d can not occur just after c respectively.
answered by Active (1.3k points)  
selected by
+1 vote
2) c cant occur just after d
4) d cant occur just after c
i think 1 nd 3 r correct
answered by Veteran (10.6k points)  

Related questions

0 votes
1 answer
1
asked in Programming by focus _GATE Veteran (20.3k points)   | 49 views
0 votes
0 answers
2


Top Users May 2017
  1. akash.dinkar12

    3140 Points

  2. pawan kumarln

    1606 Points

  3. sh!va

    1580 Points

  4. Arjun

    1316 Points

  5. Devshree Dubey

    1230 Points

  6. Angkit

    1020 Points

  7. Debashish Deka

    1012 Points

  8. Bikram

    970 Points

  9. LeenSharma

    796 Points

  10. srestha

    658 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. pawan kumarln

    232 Points

  2. jjayantamahata

    106 Points

  3. joshi_nitish

    106 Points

  4. Ahwan

    96 Points

  5. Aditya GN

    63 Points


22,717 questions
29,045 answers
65,029 comments
27,454 users