Time Complexity Flashcards

1
Q

Time Complexity

A

Time Complexity: How much time required to solve particular problem
- Measured using Big O notation, measures efficiency & effectiveness
- Upper limit for amount of time

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

Notation

A
  • O(1) = Constant time, independent from no. of inputs
  • O(n) = Linear, increases as no. of inputs increase
  • O(n^2) = Directly proportional to square of no. of inputs
  • O(n^n) = Directly proportional to no. of inputs (n) to power on n
  • O(2^n) = Amount time will double w/ each input
  • O(logn) = Times increase at smaller rate
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Space Complexity

A

Space Complexity: Amount of storage algorithm takes

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