Last active
April 24, 2020 16:43
-
-
Save adslaton/5be26ac7532731752f0b7626b1c9c1d2 to your computer and use it in GitHub Desktop.
Big O Quadratic Time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Represents an algorithm whose performance is directly proportional to the squared size of the input data set | |
for (const x of Array(n).keys()) { // O(n) | |
for (const y of Array(n).keys()) { // | |
console.log(x, y); // O(n) | |
} // | |
} | |
// O(n) * O(n) * O(1) = O(n * n) = O(n^2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment