CS 6515 Final Review Questions and Correct Answers the Latest Update
1 view 0 purchase
Course
CS 6515
Institution
CS 6515
D&C Steps
1. Figure out your Black Box if needed.
○ Sorted = Binary Search (usually)
○ Unsorted = Merge sort (usually)
○ Polynomials, convolution, multiplication = FFT(usually)
2. State the Modification if needed. You may use the blackbox as is.
○ Which part of the black box you...
CS 6515 Final Review Questions and
Correct Answers the Latest Update
D&C Steps
✓ 1. Figure out your Black Box if needed.
✓ ○ Sorted = Binary Search (usually)
✓ ○ Unsorted = Merge sort (usually)
✓ ○ Polynomials, convolution, multiplication = FFT(usually)
✓ 2. State the Modification if needed. You may use the blackbox as is.
✓ ○ Which part of the black box you are changing.
✓ ○ What are your inputs and outputs to the black box.
✓ 3. State the steps of your algorithm.
✓ ○ NO PSEUDOCODE - use words
✓ ○ Must include base case(s) if needed.
✓ ○ Always return what the problem asks for.
✓ 4. Prove Correctness
✓ ○ Proof in words of why this algorithm solves the problem.
✓ ○ Prove the base case
✓ ○ The decision to select left or right in a Binary Search.
✓ ○ Prove that the problem gets smaller.
✓ 5. Analyze the runtime.
✓ ○ Can explain in words.
✓ ○ Can use black box runtime. Must include modifications' run time.
✓ ○ Can use Master Theorem.
DP Steps
✓ Steps:
✓ 1. Find the subproblem.
✓ ○ State your ranges (not required)
✓ ■ For 1 ≤ i ≤ n
✓ ○ Define the subproblem in words.
✓ ○ Define the problem on ith item.
✓ ■ T(i) or T(i, j) is ...
✓ ○ Possibly add a constraint such as include last element
✓ ■ T(i) is ... that includes x[i].
✓ ○ Might be different than what the overall question asks.
✓ ○ For example, a True/False final answer can usually be set up with Min/Max first
and then checked at the end.
✓ ■ T(i) or T(i, j) is the maximum ...
✓ 2. Find the recurrence.
✓ ○ Must include base case(s) if needed
✓ ■ T(0) = ...
✓ ○ State your ranges
✓ ■ For 1 ≤ i ≤ n
✓ ○ Define the current problem as a relationship of smaller subproblems.
✓ ■ T(i) in terms of T(i-1)
✓ ■ T(i, j) in terms T(i-1, j), T(i, j-1), and/orT(i-1, j-1)
✓ 3. Pseudocode for algorithm.
✓ ○ No real code allowed.
✓ ○ Must include base case(s) if needed.
✓ ○ Always return what the problem asks for.
✓ ○ May be a different return from the subproblem definition.
✓ 4. Analyze the runtime.
✓ ○ Can annotate code with each runtime and compute at the end.
✓ ○ Can explain in words.
✓ ○ Include all non trivial (arithmetic) lines
Master Theorem
✓ T(n) = aT(n/b) + O(n^d)
✓
✓ -T(n) is O(n^d) if d > logb(a)
Smart Grades Latest update
1
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller Examify. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.49. You're not tied to anything after your purchase.