Time Complexity
Time Complexity
Section titled “Time Complexity”Time complexity measures how execution time grows relative to input size n.
| Complexity | Meaning | Example |
|---|---|---|
| O(1) | Constant time, doesn’t depend on input size | Access array element |
| O(log n) | Input halves each step | Binary Search |
| O(n) | Runs once per element | Linear search |
| O(n log n) | Divide and merge type algorithms | Merge Sort, Quick Sort |
| O(n²) | Nested loops | Bubble Sort |
| O(2ⁿ) | Exponential growth | Recursive subsets |