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?
Which ONE of the following is the number of nodes in T that have exactly two children?
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....
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....
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....
Total Unique Visitors
Loading......