Skip to content

Instantly share code, notes, and snippets.

@clara-shin
Last active May 28, 2018 10:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clara-shin/22aff67e07faa2dbbb169fdc41fe0d11 to your computer and use it in GitHub Desktop.
Save clara-shin/22aff67e07faa2dbbb169fdc41fe0d11 to your computer and use it in GitHub Desktop.
시간복잡도
function timeComplexity(arr, n) {
let sum = 0; // 1
let i = 0; // 1
let average = 0; // 1
while(i < n) { // n + 1
sum = sum + arr[i]; // n
i = i + 1; // n
}
average = sum / n; // 1
return sum, average; // 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment