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

 

Whats wrong with option B?

Give an example?

asked in Programming by Junior (621 points)   | 73 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 (435 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 (71 points)  


Top Users Aug 2017
  1. Bikram

    5388 Points

  2. ABKUNDAN

    4730 Points

  3. manu00x

    3582 Points

  4. akash.dinkar12

    3534 Points

  5. rahul sharma 5

    3196 Points

  6. makhdoom ghaya

    2710 Points

  7. just_bhavana

    2432 Points

  8. stblue

    2244 Points

  9. Tesla!

    2126 Points

  10. pawan kumarln

    1914 Points


25,076 questions
32,240 answers
75,170 comments
30,249 users