UGC-NET Jun 2012 · Trees

MCQ · 2 marks · Problem PROG-DSTR-0009

The Inorder traversal of the tree will yield a sorted listing of elements of tree in
  1. A
    Binary tree
  2. B
    Binary search tree
  3. C
    Heaps
  4. D
    None of the above

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionIn a binary search tree every key in the left subtree of a node is smaller than the node and every key in the right subtree is larger. Inorder visits left subtree, node, right subtree, so by induction it lists the keys in increasing order.(A) A general binary tree has no ordering between nodes — incorrect.(C) A heap orders only parent against children, not left against right — incorrect.Answer: B

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com