GATE CSE
First time here? Checkout the FAQ!
x
0 votes
60 views

 

Whats wrong with option B?

Give an example?

asked in Programming by Junior (621 points)   | 60 views

2 Answers

0 votes

Option B won't be correct  as it will print all the nodes in kth level. 

It's a kind of Depth First traversal . Has it been a Breadth First type, your conjecture may be teated correct. 

 

So, I think option A  is correct.

answered by (335 points)  
0 votes

Option B would be discarded as It is saying about kth level Nodes of BINARY TREE ,

But this program is for all node present at  K distance from a given node  ,(could be any other node in tree )

then It will print all the nodes at distance of K from that given node.

Note : Option B will be correct if in function Argument we are passing tree root node then It will print Kth level Nodes of Binary Tree.

 

answered by (51 points)  


Top Users Jun 2017
  1. Bikram

    3912 Points

  2. Arnab Bhadra

    1550 Points

  3. Hemant Parihar

    1502 Points

  4. Niraj Singh 2

    1501 Points

  5. Debashish Deka

    1480 Points

  6. junaid ahmad

    1432 Points

  7. pawan kumarln

    1366 Points

  8. Arjun

    1246 Points

  9. Rupendra Choudhary

    1242 Points

  10. rahul sharma 5

    1240 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 Jun 26 - Jul 02
  1. pawan kumarln

    498 Points

  2. akankshadewangan24

    404 Points

  3. Arjun

    286 Points

  4. Debashish Deka

    234 Points

  5. Abhisek Das

    230 Points


23,435 questions
30,153 answers
67,633 comments
28,503 users