n increases , execution time may increase depending on the algorithm's efficiency.n):
| Example Scenario | Input Size (n) | Algorithm A | Algorithm B |
|---|---|---|---|
| Small orders (Normal day) | 100 orders | takes 50 ms of time | takes 70 ms of time |
| Moderate sale event | 1,000 orders | takes 500 ms of time | takes 500 ms of time |
| Big festive sale | 10,000 orders | takes 5,000 ms of time | takes 3,000 ms of time |
| Massive flash sale | 1,00,000 orders | takes 50,000 ms of time | takes 15,000 ms of time |
| Symbol | Name | Description | Efficiency | Notes / Examples |
|---|---|---|---|---|
| O(1) | Constant Time | Execution time does not depend on input size. | ✅ Excellent | Accessing an array element, HashMap get() |
| O(log n) | Logarithmic Time | Time grows slowly as input size increases. | ✅ Very Good | Binary Search, balanced BST operations |
| O(n) | Linear Time | Time grows directly in proportion to input size. | 👍 Good | Traversing an array or list |
| O(n log n) | Linearithmic Time | Slightly worse than linear but better than quadratic. | ⚖️ Acceptable | Merge Sort, Quick Sort (average case) |
| O(n²) | Quadratic Time | Time grows proportionally to the square of input size. | ❌ Poor | Nested loops (e.g., Bubble Sort) |
| O(n³) | Cubic Time | Time grows cubically with input size. | ❌ Very Poor | Triple nested loops |
| O(2ⁿ) | Exponential Time | Time doubles with every additional input element. | 🚫 Extremely Bad | Recursive Fibonacci without memoization |
| O(n!) | Factorial Time | Time grows factorially with input size. | 🚫 Worst | Generating all permutations |
n increases , memory usage may increase depending on the algorithm's efficiency.n):
| Example Scenario | Input Size (n) | Algorithm X | Algorithm Y |
|---|---|---|---|
| Small image (Profile pic) | 1 MB | uses 5 MB memory | uses 4 MB memory |
| Medium image (Phone photo) | 5 MB | uses 25 MB memory | uses 15 MB memory |
| Large image (DSLR photo) | 20 MB | uses 100 MB memory | uses 50 MB memory |
| Ultra HD image (Poster) | 100 MB | uses 500 MB memory | uses 300 MB memory |
n).
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
We’re here to make our tutorials better based on your thoughts and suggestions.