What is the time complexity of searching in a sorted array?

What is the time complexity of searching in a sorted array?

Approach: Analyze binary search.

O(log n) using binary search.

Follow-up: What is the complexity if the array is not sorted?

Key concepts: logarithmic time.