Exam 1 - Divide and Conquer Flashcards
Is pseudocode allowed in the D&C written questions?
No
In the D&C written questions, each recurrence should be a ____ problem than before
Smaller
In the D&C written questions, each solution must be more efficient than ____
The brute force solution
In the D&C written questions, what are the three sections expected?
Algorithm Description
Correctness Justification
Runtime Analysis
In the D&C written questions, what is expected in the Algorithm Description section?
How to solve the problem
In the D&C written questions, what is expected in the Justification of Correctness section?
Why the algorithm solves the problem
In the D&C written questions, what is expected in the Runtime Analysis section?
The big-O runtime of the algorithm, including the big-O runtimes for all nontrivial steps of the algorithm
In the D&C written questions, can the master theorem be used for the runtime analysis?
Yes
What is the input for FastMultiply?
Two n-bit integers x and y, where n is some power of two
What is the output of FastMultiply?
x times y
FastMultiply starts by splitting x and y into what components?
X_l, Y_l, X_r, Y_r
They are the left and right n/2 bits of x and y
After FastMultiply splits X and Y into left and right halves, how does it calculate the three subproblems?
A is FastMultiply(X_l,Y_l)
B is FastMultiply(X_r,Y_r)
C is FastMultiply(X_l+X_r,Y_l+Y_r)
After FastMultiply calculates A, B, and C, how does it use those values to calculate the output value?
2^n * A +
2^(n/2) * (C - A - B)
+ B
What’s the input formula for the master theorem?
What are the input constraints of the master theorem?
a > 0, b > 1, d >= 0
What is the result of the master theorem if d > log (b, a)
O(n^d)
What is the result of the master theorem if d = log (b, a)
O(n^d log n)