PA of Algorithms Q84

0. A list of n strings, each of length n, is sorted into lexicographic order using the merge sort algorithm. The worst case running time of this computation is

  • Option : B
  • Explanation :
    Recurrence relation for merge sort
    T (n) = 2 T (n/2) + n
    So T (n) = O(n logn)
    but instead of integers whose comparison take O(1) time, we are given n strings so to compare strings we need O(n) time hence complexity is Q(n2 logn)
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 *