Skip to content

Instantly share code, notes, and snippets.

@eengineergz
Created February 27, 2021 04:47
Show Gist options
  • Save eengineergz/3e6096e66bac80b962435b7d873cdbe9 to your computer and use it in GitHub Desktop.
Save eengineergz/3e6096e66bac80b962435b7d873cdbe9 to your computer and use it in GitHub Desktop.
// 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