Big O notation is used to describe the efficiency of algorithms in terms of time complexity and space complexity. It helps us understand how an algorithm scales as the input size increases.
| Notation | Complexity Class | Description |
|---|---|---|
| O(1) | Constant Time | Execution time is the same regardless of input size. |
| O(log n) | Logarithmic Time | Execution time increases logarithmically with input size. |
| O(n) | Linear Time | Execution time grows proportionally to input size. |
| O(n log n) | Linearithmic Time | Common in efficient sorting algorithms like Merge Sort and Quick Sort. |
| O(n²) | Quadratic Time | Execution time grows quadratically with input size. |
| O(2ⁿ) | Exponential Time | Execution time doubles with each additional element. |
| O(n!) | Factorial Time | Execution time grows factorially, very inefficient for large inputs. |