Computer Science
How do you find the Big-O time complexity of code?
Count how the number of steps grows as the input size n grows, then keep only the fastest-growing term and drop constants. One loop over n items is O(n), a loop nested inside another is O(n²), and a loop that halves n each time is O(log n). Loops one after another add; loops inside each other multiply.