ON Linear Time

1 min read
Rapid overview

O(n) - Linear Time

Operations that scale linearly with input size.

const sum = (items: number[]) => items.reduce((acc, item) => acc + item, 0);

Notes

  • Single passes through arrays are O(n).
  • Filtering and mapping are O(n).