Which of the below given statements are correct about Trees?
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Which of the below given statements are correct about Trees?
I) Binary search tree can be used to sort elements
II) Trees can be implemented using array
III) Trees can be implemented using linked list
Show answer & explanation
All three statements are correct. Statement I is true: in-order traversal of a BST produces sorted output. Statement II is true: trees can be represented in arrays using index-based parent-child relationships (parent at i, children at 2i and 2i+1). Statement III is true: trees are commonly implemented using linked lists with node pointers. Therefore, the correct answer is D.
Step-by-step Derivation:
Evaluate each statement:
Statement I: Binary search tree can be used to sort elements
- TRUE. In-order traversal (Left → Root → Right) of a BST yields elements in sorted order.
- Example: BST with values [5, 3, 7, 1, 4, 6, 8] → in-order gives [1, 3, 4, 5, 6, 7, 8]
Statement II: Trees can be implemented using array
- TRUE. Array-based representation uses index mapping:
- Node at index i has left child at 2i+1, right child at 2i+2 (0-indexed)
- Or left child at 2i, right child at 2i+1 (1-indexed)
- Commonly used for heap data structures and complete binary trees
Statement III: Trees can be implemented using linked list
- TRUE. Each node contains data and pointers to child nodes.
- Most flexible and common approach: struct Node { data; left_ptr; right_ptr; }
- Supports any tree structure without space overhead from unused array slots
Conclusion: All three statements I, II, and III are correct → Answer is D.