Which one of the given options is not a type of binary tree?
Qualcomm technical mcq question, verified with a worked answer. Free to practise - no sign-up.
Which one of the given options is not a type of binary tree?
Show answer & explanation
A K-ary tree is a generalized tree where each node can have up to K children, making it not restricted to binary (2 children). A binary tree specifically limits each node to at most 2 children. Heaps, expression trees, and threaded trees are all specialized implementations or variants of binary trees.
Step-by-step Derivation:
Binary trees have the fundamental property that each node has at most 2 children. Let's verify each option:
K-ary tree: By definition, a K-ary tree allows each node to have up to K children. When K > 2, it is NOT a binary tree. When K = 2, it becomes a binary tree specifically. So K-ary is a broader category that generalizes binary trees.
Heap: A heap is a complete binary tree that satisfies the heap property (min-heap or max-heap). It is always a binary tree.
Expression tree: An expression tree represents mathematical or logical expressions using a binary tree structure where operators are internal nodes and operands are leaf nodes. It is a binary tree variant.
Threaded tree: A threaded tree is a binary tree variant where unused pointers in leaf/semi-leaf nodes are reused to point to predecessor/successor nodes (in-order threading). It is still a binary tree.
Conclusion: K-ary tree is NOT a type of binary tree; rather, binary trees are a special case of K-ary trees (when K=2).