Data Structures and AlgorithmsBig-O Notation

Big-O notation describes the performance and efficiency of an algorithm. It measures how runtime or space requirements grow as the input size increases. Common complexities include O(1), O(log n), O(n), O(n log n), and O(n^2).

// Example: O(n) linear complexity
function printArray(arr) {
  arr.forEach(item => console.log(item));
}
printArray([1,2,3,4]);