Created
February 27, 2021 04:47
-
-
Save eengineergz/3e6096e66bac80b962435b7d873cdbe9 to your computer and use it in GitHub Desktop.
This file contains 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
// O(n^2) | |
function quadratic(n) { | |
for (let i = 1; i <= n; i++) { | |
for (let j = 1; j <= n; j++) {} | |
} | |
} | |
//Example of Quadratic and Cubic runtime. | |
// O(n^3) | |
function cubic(n) { | |
for (let i = 1; i <= n; i++) { | |
for (let j = 1; j <= n; j++) { | |
for (let k = 1; k <= n; k++) {} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment