1.

What is the time complexity of binary search with iteration?(a) O(nlogn)(b) O(logn)(c) O(n)(d) O(n^2)This question was addressed to me in final exam.My query is from Binary Search Iterative topic in portion Searching of Data Structures & Algorithms II

Answer»

Correct choice is (B) O(LOGN)

The best explanation: T(n) = T(n/2) + THETA(1)

USING the divide and conquer MASTER theorem, we get the time complexity as O(logn).



Discussion

No Comment Found

Related InterviewSolutions