Recursive Searching and Sorting (Binary Search, Merge Sort)

AP Computer Science A· difficulty 2/5

// mergesort on n elements

What is the time complexity?

  • A

    O(n)

  • B

    O(n log n)

    check_circle
  • C

    O(log n)

  • D

    O(n^2)

Explanation

Mergesort divides log n levels and merges O(n) per level: O(n log n).

Want 10 more like this — adaptive to your weak spots?

Related questions