Fullstack Wolfpack

Blog, tutorials and videos about full stack skills

Big O

how much time and space would this code take
int sun(int n) {
  if (n <= 0) {
    return 0;
  return n + sum(n-1);
O(n) time & O(n) space
what is O(1) called
bounded time
what is O(log n) called
logarithmic time
what is O(n) called
linear time
what is O(n log n ) called
n log n time
what is O(n²) called
quadratic time
what is O(n³) called
cubic time
what is O(2ⁿ) called
exponential time