Algorithms · Question 16 · Easy

What is the best-case time complexity of linear search on an array of n elements?

  1. O(n/2)
  2. O(n)
  3. O(log n)
  4. O(1)
Answer and explanation

Answer: D. O(1)

Explanation: In the best case the key is the first element checked, so the search ends after a single comparison, which is constant time.

Previous: Using the Master theorem, what is the solution of T(n) = 3T(n/2) + n? · Next: Which of the following sorting algorithms is stable in its standard…

Practise algorithms

Try a fresh set of algorithms questions with an explanation after every answer, free and without signing up: Algorithms practice. Or sit a full placement mock test.

More algorithms questions

More technical & programming practice

Object-Oriented Programming · DBMS · SQL · Operating Systems · Computer Networks · Software Engineering · Cloud & DevOps · GenAI Basics

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge