Skip to content

Instantly share code, notes, and snippets.

@tcelovsky
Created January 6, 2022 23:03
Show Gist options
  • Save tcelovsky/34038e0b815b3978d03a157e8a779907 to your computer and use it in GitHub Desktop.
Save tcelovsky/34038e0b815b3978d03a157e8a779907 to your computer and use it in GitHub Desktop.
O(1) or Constant Complexity Gist
function add_numbers(a, b, c) {
let total = 0 //O(1) --> constant complexity (a variable is initialized)
total = a + b + c //O(1) --> constant complexity (a variable is re-assigned)
return total
}
add_numbers(2, 5, 7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment