PA of Algorithms Q112

0. The usual Θ(n2) implementation of Insertion Sort to sort an array uses linear search to identify the position where an element is to be inserted into the already sorted part of the array. If instead, we use binary search to identify the position, the worst case running time will

  • Option : A
  • Explanation :
    Complexity is remain same because we had swap after finding to position of element so in worst case swapping for each element requires Q (n) time hence complexity is O (n2).
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 *