PA of Algorithms Q87

0. Assume that the algorithms considered here sort the input sequences in ascending order. If the input is already in the ascending order, which of the following are TRUE?
I. Quicksort runs in Θ(n2) time
II. Bubblesort runs in Θ(n2) time
III. Mergesort runs in Θ(n) time
IV. Insertion sort runs in Θ(n) time

  • Option : D
  • Explanation :
    1. Quicksort will take worst case, if the input is in ascending order i.e Θ(n2)
    2. Insertion sort runs in Θ(n) time.
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 *