ExamPreparation | QuizTime | LearningTools | Education | StudentSupport
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
Smart Grades Latest update
1
, Examify | OnlineExams | TestPrep | StudyResources | AcademicSuccess |
ExamPreparation | QuizTime | LearningTools | Education | StudentSupport
✓ ○ 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