Multiple choice

In-order traversal of a tree will yield a sorted list of elements of tree in

  1. binary trees

  2. binary search trees

  3. heaps

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

Binary search tree has all the small data in left and all big data in right. So, when inorder traversal is made, it gives sorted list. Suppose tree is having data 1, 2, 3, 4 and 5, if 3 is the root element then 4 and 5 will be on right side of the root. 1 and 2 will get place in left side of 3. So, inorder traversel of BST will give sorted elements.