sajad torkamani

In a nutshell

An algorithm is considered O(n^2) when its runtime increases by a factor of 2n relative to the input size.

export function printPairs(n: number): void {
  for (let i = 0; i < n; i++) {
    for (let j = 0; j < n; j++) {
      console.log(i, j);
    }
  }
}

printPairs(5)
printPairs(10)

Leave a comment

Your email address will not be published. Required fields are marked *