Problem Set 1: Big-And Divide & Conquer: CS 3510: Design & Analysis of Algorithms
Problem Set 1: Big-And Divide & Conquer: CS 3510: Design & Analysis of Algorithms
• Please type your solutions using LATEX or any other software. Handwritten solutions will not
be accepted for this assignment.
• Your algorithms must be in plain English & mathematical expressions. Pseudo-code without
sufficient explanation will receive no credit.
• If we ask for an algorithm with a specific runtime, we will only accept answers with that
specific runtime, even if a faster solution exists. If we ask for an “efficient” algorithm, we
will not accept answers if a faster algorithm than the one provided exists.
• Unless a question explicitly states that no work is required to be shown, you must provide
an explanation or justification for your answer.
• Why each group is asymptotically bounded by the group with the next highest growth rate
• Why each function belongs in its assigned group (if the group contains more than one func-
tion)
(a.) n5/3
(g.) n!
n
(h.) 22
(i.) log(n!)
(a.) What is the runtime of both Student A’s and Student B’s algorithms? Which one runs faster,
if either?
(b.) Now consider Student C, who devises an algorithm for the same problem. Her solution in-
volves solving 4 subproblems, each of size n/4, and requires O(n) time to combine the results.
Determine whether this approach is faster than the algorithm selected in part (a).
Design an efficient divide-and-conquer algorithm that determines the number of elements in A that
do not fall within the range [l, u] (inclusive).
For example, consider the sorted array A = [2, 5, 8, 12, 16], with l = 6 and u = 16. The elements
outside the range [6, 16] are 2 and 5, so the output should be 2.
Hint. There are two distinct subsets of the list: elements within the range and elements outside
the range.
(a.) Describe your algorithm to a degree where someone could implement it if given your answer.
Please reference “Algorithm Design” in the Assignment Guidelines uploaded to
Canvas.
(b.) Argue why your algorithm is correct (given any input, why does your algorithm produce the
correct outputs). Please reference “Algorithm Analysis” in the Assignment Guide-
lines uploaded to Canvas.
(c.) Give the runtime of your algorithm and explain the reasoning.
Assume the neighbors of an entry only include its adjacent entries in the same row or in the same
column (i.e. not diagonal entries).
(a.) Describe your algorithm to a degree where someone could implement it if given your answer.
Please reference “Algorithm Design” in the Assignment Guidelines uploaded to
Canvas.
(b.) Argue why your algorithm is correct (given any input, why does your algorithm produce the
correct outputs). Please reference “Algorithm Analysis” in the Assignment Guide-
lines uploaded to Canvas.
(c.) Give the runtime of your algorithm and explain the reasoning.