Tuesday, January 21, 2025
HomeMathematicsWhat Does O(log n) Mean Exactly?

What Does O(log n) Mean Exactly?

O(log n) describes the time complexity of an algorithm, indicating its efficiency. It means that as the input size nn grows, the algorithm’s runtime increases logarithmically. Specifically, the runtime is proportional to the logarithm of nn, typically base 2 (logâ‚‚).

See also  What Are the Units of Molar Absorptivity

This behavior is common in divide-and-conquer algorithms like binary search, where the input size is halved at each step. For example, searching in a sorted list of 1,000,000 elements takes about 20 steps in binary search (log₂(1,000,000) ≈ 20).

See also  How Many 1/4 Cup Servings Are In 4 Cups Of Oatmeal?

O(log n) is efficient, as it grows much slower than linear (O(n)) or quadratic (O(n²)) time complexities.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x