GATE Computer ScienceEasyGATE CS (PYQ pattern)
A binary tree with 25 nodes has two pointer fields per node. How many of these 50 fields hold NULL, and how many hold NULL if the tree is a full binary tree (every node has 0 or 2 children) with 25 nodes?
- A. 26 and 13
- B. 25 and 26
- C. 26 and 26
- D. 24 and 24
Correct answer: C. 26 and 26
Every non-root node is the target of exactly one pointer, so 24 fields are non-NULL and 50 - 24 = 26 are NULL whatever the shape; a full tree with 25 nodes is no exception (13 leaves, 26 NULL fields).
Practise more Programming and Data Structures (GATE) questionsProgramming and Data Structures (GATE): notes and key points
More Programming and Data Structures (GATE) questions
- A circular queue of capacity 10 (array indices 0..9) keeps front and rear indices; front is the index of the first item and rear is the…
- Convert the infix expression a - b c / d + e (f - g) / h (all binary operators left-associative; and / bind tighter than + and -) to…
- Evaluate the prefix expression - + 4 5 - 9 3 / 20 + 2 3 (integer division truncating toward zero).
- Under the uniform-hashing assumption, a linear-probing table has load factor 0.5. Using the Knuth approximations, the expected number of…
- In the BST built by inserting 40, 20, 60, 10, 30, 50, 70, 25, 35, 45, 55, 65, 75, 22 in order, what are the inorder successor of 35, the…
- int f(int n) { if (n == 0) return 1; return f(n - 1) + f(n - 1); } How many calls to f (including the first) does f(10) make?