L2 (Asymptotic Notation) Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What does it mean to say f(n) is in O(g(n)), or f(n) = O(g(n))?

What does this mean in terms of the runtime of the algorithm?

A
  • We say f(n) = O(g(n)) if there exists constants N > 0 and c > 0 such that f(n) <= c*g(n) for all n >= N
  • This means that the run-time of the algorithm has an upper bound of O(g(n))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

We use the terms f(n) and g(n) when describing big-O notation. What exactly are these functions?

A

f(n) and g(n) are functions which map positive integers (n) to positive real numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does it mean to say f(n) is in Omega(g(n)), or f(n) = Omega(g(n))?

What does this mean in terms of the runtime of the algorithm?

A
  • We say f(n) = Omega(g(n)) if there exists constants N > 0 and c > 0 such that f(n) >= c*g(n) for all n >= N
  • This means that the runtime of the algorithm has a lower bound of Omega(g(n))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

f = ____ tells us that f grows no faster than g
f = ____ tells us that f grows at least as fast as g
f = ____ tells us that f and g grow at the same rate

A

O(g)
Omega(g)
Theta(g)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What does it mean to say f(n) is in Theta(g(n)), or f(n) = Theta(g(n))?

What does this mean in terms of the runtime of the algorithm?

A
  • We say f(n) = Theta(g(n)) if there exists constants c1 > 0, c2 > 0 and N > 0 such that c1g(n) >= f(n) >= c2g(n) for all n >= N
  • This means that f(n) is in both O(g(n)) and Omega(g(n))
  • The runtime has both an upper and lower bound of g(n)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly