Search⌘ K
AI Features

Complexity Analysis

Let's discuss how fast binary search is and how much memory it uses.

We'll cover the following...
Technical Quiz
1.

What will be the space complexity for binary search in terms of Big O notation?

A.

O(log_2 \space n)

B.

O(2 ^ n)

C.

O(1)

D.

O(n ^ 2)


1 / 1
Technical Quiz
1.

What will be the time complexity for binary search in terms of Big O notation?

A.

O(log_2 \space n)

B.

O(2 ^ n)

C.

O(n)

D.

O(n ^ 2)


1 / 1

Time complexity

The essential property of binary search is to reduce the search area to, nearly, half of the original size.

Suppose we have n` elements in our search array. On each iteration, we’re down to ​ 2n elements. The ...