Simple Idea
If an algorithm checks each item once, then more items mean proportionally more work. That is why many simple scans are O(n). If the algorithm uses nested loops over the same data, work can grow much faster.
Time complexity means how the amount of work grows when the input gets bigger. It is not the exact number of seconds. It is the growth pattern of the algorithm.
If an algorithm checks each item once, then more items mean proportionally more work. That is why many simple scans are O(n). If the algorithm uses nested loops over the same data, work can grow much faster.
For a small list, almost any method feels fast. For a very large list, the growth rate matters a lot. A method that does too many repeated comparisons becomes slow much sooner.
Open a student register and read the name written in the first row. It is one direct action, whether the register has 20 students or 2,000 students.
A teacher checking attendance by calling every student's name one by one is doing O(n) work. More students means more names to call.
Looking for a word in a dictionary is like O(log n). You open near the middle, decide whether to go left or right, then cut the remaining search area in half again.
Imagine comparing every student in a class with every other student to see who should stand earlier in a line. That repeated pair-by-pair checking grows very quickly, like O(n²).
Think about finding a word in a printed dictionary. You do not start from page 1 and turn every page. You open near the middle, check the word, then immediately ignore half of the dictionary. After that, you again ignore half of what is left. That is why Binary Search is O(log n).
Ask this question: "If the input gets bigger, how many more steps will this algorithm do?" One direct action: often O(1) Cut the remaining work in half each time: often O(log n) Check everything once: often O(n) Compare many pairs again and again: often O(n^2)