Computer Sciences > GATE 2025 SET-2 > Trees
Consider a binary tree T in which every node has either zero or two children. Let n>0 be the number of nodes in T.
Which ONE of the following is the number of nodes in T that have exactly two children?
A
(n-2)/2
B
(n-1)/2
C
n/2
D
(n+1)/2

Correct : b

We can find an element that is not the largest with just one comparison: take any two elements from the list, compare them, and the smaller one is guaranteed not to be the largest since the other element is larger. Because the integers are distinct, no ties occur. This method works regardless of where the largest element is in the list.

Final Answer: Option (a) β€” 1.

Reason: The smaller of two compared elements is definitely not the largest, so only one element comparison is needed in the worst case.

Similar Questions

Consider a complete binary tree with 7 nodes. Let A denote the set of first 3 elements obtained by performing Breadth-First Search (BFS) starting from the root....
#1081 Fill in the Blanks
Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, t...
#1271 Fill in the Blanks
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having n distinct integers?
#1369 MCQ

Related Topics

full binary tree GATE 2025 GATE CS 2025 Set-2 Q13 internal nodes two children binary tree n nodes formula leaf nodes internal nodes (n-1)/2 internal nodes data structures trees GATE full binary tree property GATE computer science 2025

Unique Visitor Count

Total Unique Visitors

Loading......