Sail E0 Webinar
Question
Does there exist a heap with seven distinct elements so that the In order traversal gives the element in sorted order.
Options:
A .  Yes
B .  No
C .  Both I and II
D .  None of these
Answer: Option B


No, The inorder traversal will not give elements in sorted order. As heap is implemented as either min-heap or max-heap ,the root
will be have highest or lowest value than remaining values of the nodes .So this traversal will not give a sorted list.



Was this answer helpful ?

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers