Understanding Big-O Notation
O(1) - Constant time: operation count doesn't change with input size, e.g., array index access
O(n) - Linear time: operations grow proportionally with input size, e.g., a single loop through an array
O(log n) - Logarithmic time: operations grow slowly as input size increases, typically from halving the problem each step, e.g., binary search
O(n log n) - Linearithmic time: common in efficient sorting algorithms like Merge Sort and Quick Sort (average case)
O(n^2) - Quadratic time: operations grow with the square of input size, typically from nested loops, e.g., Bubble Sort