That difference is Big O
Tap to start →
Reading arr[5] takes one step, whether the array has 10 items or 10 million.
Checking every item once. Twice the data, twice the time.
Comparing every pair. 1,000 items means about a million steps.
Binary search cuts the range in half each step. A million items take about 20 steps.
Counting exact steps. Big O drops constants: 3n + 5 is just O(n).
Tap an answer. The full video explains why.
Free DSA in Java course. Subscribe to Compiled Canvas on YouTube.