Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

Big-O notation

QuestionAnswer
Precision of Complexity orders Just need to know order of complexity, not precise, linear, quadratic, constant, logarithmic, nlogn, exponential etc. Look at largest factor in growth
Big O notation-definition Describes worst case complexity, relative to input size
How to calculate Big-O/asymptotic complexity 1. Count steps {2. discard additive and multiplicative constants} 3. Focus on dominant terms
Comparing nlogn with other complexities Between linear and quadratic
Laws of addition for O(f(n)) 1. Used with sequential statements 2. O(f(n)) + O(g(n)) is O(f(n) + g(n))
Laws of multiplication for O() 1. Used with nested statements/loops 2. O(f(n)) * O(g(n)) is O(f(n) * g(n))
Nested loops complexity Quadratic.
Constant complexity-Definition Complexity independent of inputs.
Loops or recursion with constant complexity Can have loops or recursion but only if independent of input size.
Log linear complexity-Types of algorithms Many commonly used algorithms are log-linear, including merge sort.
Polynomial complexity-Most common leading term Most often quadratic.
EXPONENTIAL complexity-Patterns of functions 1. Recursive functions 2. where more than one call for each size of problem (e.g. Towers of Hanoi).
Complexity classes 1. Constant 2. Logn 3. Linear 4. Polynomial 5. Exponential 6. Log-linear
Types of programs of Linear complexity simple iterative or recursive programs
Logn complexity problem reduces in size by half each iteration
T(n) = O(f(n)) F(n) describes the upper bound of T(n) (no lower bound)
T(n) is omega f(n)
Omega f(n) describes the lower bound of T(n)
T(n) is θ f(n) Means that the complexity of T(n) is between a lower and upper bound, both which look like f(n), but may differ by a constant factor. (e.g. X² and 1.2X²)
T(n) = o(f(n)) f(n) is an upper bound for T but T will always be lower than f(n)
Possible solutions to exponential complexity Can try approximate solutions to provide the answer more quickly.
Constant complexity-Applications Not many interesting algorithms in this class but sometimes have pieces that fit.
Polynomial complexity-Common algorithm structure Often seen with nested recursive function calls or nested loops.
Nested loop complexity-Explanation For each outer loop, execute the inner loop.
Nature of problems with exponential algorithms Many problems are inherently exponential.
Exponential v Quadratic Quadratic is n² l, exponential is 2ⁿ
NP hard problem No solution with less than exponential complexity
Relative cost of exponential problems Cost can be high.
What impact do additive and multiplicative constants generally have on asymptotic complexity They are typically ignored
Does the difference between θ and O matter? Not in most cases. In most cases, don't care about how a program runs when most efficient, so lower bound is irrelevant.
For θ can two functions differ by an exponent (e.g. X² and X⁴) and still be considered similar looking for Theta? No. Differing exponents don't count as differing by a constant factor.
How different are θ(n) and θ(logN) As different as θ(n) and θ(2ⁿ)
Converting a log into exponenential terms For any C > 0 logn is O(nᶜ) (because a logarithm grows asymptotically slower than any positive constant exponent, and O only cares about not overestimating).
How does the growth rate of a fractional exponent compare to linear time? It is less. √(n) < n
How does the growth rate of √n compare to log(n) It is greater. logn<√(n)
Created by: LuminatedLucy
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards