964 views
1 votes
1 votes

Consider the following C program segment:
struct node

What is the output of above C program when it runs on a root node of a binary tree?

  • prints nodes at K distance from root node.
  • print nodes of Kth level of binary tree.
  • Both (a) and (b)
  • None of these

1 Answer

0 votes
0 votes
Answer depends on numbering of levels:

if levels starts from zero then C will be correct option

if levels start from 1 then only A will be correct

Related questions

3 votes
3 votes
5 answers
1
srestha asked May 22, 2019
1,800 views
Consider the following function height, to which pointer to the root node of a binary tree shown below is passedNote that max(a,b) defined by #define max(a,b) (a>b)?a:b.i...
0 votes
0 votes
3 answers
3
thor asked Nov 27, 2016
4,239 views
The minimum size that an array may require to store a binary tree with n nodes$2^{\left \lceil(log_2(n+1)) \right \rceil -1}$$2n-1$$2n-n+1$$n+1$
1 votes
1 votes
1 answer
4
Nishisahu asked Dec 25, 2021
1,186 views
Suppose there are $11$ nodes in a binary tree. Find the number of unlabeled binary trees if the number of nodes either in the left sub tree or in the right sub tree is di...