Skip to content

Commit 596e9d0

Browse files
author
Nilton Lopes
committed
Complexidade O(1)
1 parent 93172aa commit 596e9d0

File tree

1 file changed

+11
-0
lines changed
  • src/js/complexity-of-algorithms

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* Um algoritmo com complexidade O(1) é um algoritmo em que sua complexidade é constante, ou seja, não importa qual seja
3+
* a entrada ele sempre leverá o mesmo tempo para ser executado.
4+
*/
5+
6+
function increment(num) {
7+
return ++ num
8+
}
9+
10+
11+
console.log(increment(2));

0 commit comments

Comments
 (0)