Which of the following algorithms has the smallest time complexity?(1 point)

Responses

merge sort
merge sort

insertion sort
insertion sort

binary search
binary search

linear search

1 answer

To analyze the time complexity of the provided algorithms:

  1. Merge Sort: This is a divide-and-conquer algorithm with a time complexity of \( O(n \log n) \).

  2. Insertion Sort: This algorithm has a time complexity of \( O(n^2) \) in the average and worst cases, but \( O(n) \) in the best case (when the array is already sorted).

  3. Binary Search: This algorithm is used to find an element in a sorted array and operates with a time complexity of \( O(\log n) \).

  4. Linear Search: This algorithm searches for an element in an unsorted array and has a time complexity of \( O(n) \).

Among these algorithms, binary search has the smallest time complexity of \( O(\log n) \).