Algorithm Learning/O(n) - Linear Time

O(n) - Linear Time

Learn O(n) with array sum. Honestly visit all elements once!

EasyComplexityLinear SearchArray

Definition

O(n) is "Linear Time", where time grows proportionally with data size N.

Key Characteristics

  • Honest Growth (1:1)
  • Check All Data Once
  • Most Common Algorithm

Use Cases

Used in these scenarios:

🔍

Linear Search

Search one by one from start to end

📊

Array Traversal

Sum, max/min, average

🔗

Linked List

Traverse to reach Nth node

Complexity

Time Complexity

Best
O(n)
Average
O(n)
Worst
O(n)

Space Complexity

O(1)

Understand Deeper with Visualization

See how the algorithm works through step-by-step animations and code execution.

Start Visualization