What is the time complexity of merge sort?

2017

What is the time complexity of merge sort?

  1. A.

    O(n)

  2. B.

    O(n2)

  3. C.

    O(nlogn)

  4. D.

    O(logn)

Attempted by 106 students.

Show answer & explanation

Correct answer: C

Merge sort recursively divides the array and merges sorted halves. Its time complexity is O(n log n).

Explore the full course: Coding For Placement