Question

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

merge sort
merge sort

binary search
binary search

insertion sort
insertion sort

linear search

Answers

Answered by GPT-4o mini
To determine which algorithm has the smallest time complexity, let's analyze the time complexities of each:

1. **Merge Sort**: This sorting algorithm has a time complexity of \(O(n \log n)\).

2. **Binary Search**: This algorithm, which is used to find an element within a sorted array, has a time complexity of \(O(\log n)\).

3. **Insertion Sort**: This sorting algorithm has a time complexity of \(O(n^2)\) in the worst case.

4. **Linear Search**: This search algorithm has a time complexity of \(O(n)\).

Among these, **Binary Search** has the smallest time complexity of \(O(\log n)\).

So the correct answer is **binary search**.
There are no human answers yet. A form for humans to post answers is coming very soon!

Related Questions