0

I'm taking my first algorithms class, and the first exam is tomorrow. I've been looking forward to this class since freshman year, but now that I'm in it the professor is less than stellar and I've been having trouble (making tomorrow's exam worrying). We've covered the meaning of each of the notations, but we'll be asked on the exam questions like:

  • Prove max(f, g) = Θ(f + g)
  • Prove (n + a)^b = Θ(n^b)
  • Is 2^(n+1) = O(2^n)?

I've never worked with these kinds of proofs before. I've been trying to look these problems up on a case-by-case basis, but I've realized that's a terrible idea. What my professor's failed to reasonably explain in class is how to actually approach these kinds of problems. Could someone help explain to me as simply as possible how to approach these so that I can handle any type of proof like this in the future?

Edit: This isn't a duplicate of the suggested question at all. I am not asking of the meaning of the given notations, the growth rates or certain function types, or which one to use at all. I am asking how to prove that a given specific function has a certain complexity.

Jared
  • 101
  • 2
  • 3
    more help in https://cs.stackexchange.com/questions/824/sorting-functions-by-asymptotic-growth – Ran G. Oct 06 '15 at 01:09
  • Neither question you've given is related at all. Sorry. – Jared Oct 06 '15 at 01:15
  • 1
    I'm not sure I get you. You understand the meaning of, say, $O(2^n)$ but you don't know how to prove whether or not $2^{n+1} =O(2^n)$? To me it seems you still don't understand the meaning of $O$, $\Omega$, etc. Maybe try to be more specific, so we could help. – Ran G. Oct 06 '15 at 01:47
  • The third question you've posted looks hopeful and I'm reading through it, thank you. I understand that 2^(n+1)=O(2^n) means that the function has a runtime of "at worst, 2^n" meaning that the upper-bound of the runtime curve would be the function y=2^x. However, I don't understand what goes in to proving this statement. I've never written a proof in my life, and the format of the proofs that I've seen intimidate me. I don't know what writing one entails, and I don't think I've been equipped to write one myself and be confident that it is correct. – Jared Oct 06 '15 at 01:52
  • Still don't get your question, but maybe https://cs.stackexchange.com//questions/192/how-to-come-up-with-the-runtime-of-algorithms is what you are missing. – Ran G. Oct 06 '15 at 01:58
  • A user proved the first example I listed here in the accepted answer. I understand the proof, but what I am wanting to know is his thought process in coming up with the proof so I can use that thought process to create proofs for functions like the other two examples. – Jared Oct 06 '15 at 02:01
  • I see. Then look more carefully in the second question I posted. The (first) answer there covers this as well. – Ran G. Oct 06 '15 at 02:05
  • I recognize the answer to the second question as the ratio test from Calculus II, and it looks extremely useful for my situation, but I'm unconfident in how to apply it. For example, how could I use it to solve the second example I gave? – Jared Oct 06 '15 at 02:16
  • The 3rd sample is basically a dup of "How to prove that 2^(n+3)=O(2^n)?", though the answer doesn't go into too much depth. "Does f(n)+g(n)=O(g(n)⋅f(n)) hold?" has more detailed answers about another example. – outis Oct 06 '15 at 03:45
  • "Finding asymptotic time complexity" isn't a dup, but should be illuminating. What kind of proofs have you worked with? – outis Oct 06 '15 at 03:52
  • @outis Our canonical question on how to show that $f(x)=O/\Omega/\Theta(g(x))$ is Sorting functions by asymptotic growth. – David Richerby Oct 06 '15 at 07:07

0 Answers0