CPArrys Q8

0. Minimum number of interchange needed to convert the array 89,19,40,14,17,12,10,2,5,7,11,6,9,70, into a heap with the maximum element at the root is

  • Option : C
  • Explanation :
    Only element 70 violates the rule. Hence, it must be shifted to its proper position.
    Step1: swap(10, 70)
    Step2: swap(40, 70)
    Hence, only 2 interchanges are required.
Cancel reply

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


Cancel reply

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