0% found this document useful (0 votes)
12 views5 pages

Problem Set 1: Big-And Divide & Conquer: CS 3510: Design & Analysis of Algorithms

The document outlines Problem Set 1 for CS 3510, focusing on Big-O notation and Divide & Conquer algorithms, due on January 14th, 2025. It specifies formatting requirements for solutions, including the need for clear explanations and justifications for algorithms, as well as the grouping and ranking of functions by growth rates. The problem set includes tasks related to analyzing student algorithms, designing efficient algorithms for specific problems, and providing runtime analyses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

Problem Set 1: Big-And Divide & Conquer: CS 3510: Design & Analysis of Algorithms

The document outlines Problem Set 1 for CS 3510, focusing on Big-O notation and Divide & Conquer algorithms, due on January 14th, 2025. It specifies formatting requirements for solutions, including the need for clear explanations and justifications for algorithms, as well as the grouping and ranking of functions by growth rates. The problem set includes tasks related to analyzing student algorithms, designing efficient algorithms for specific problems, and providing runtime analyses.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

CS 3510: Design & Analysis of Algorithms January 8th 2025

Problem Set 1: Big-O and Divide & Conquer


YOUR NAME HERE Due: January 14th 2025

• 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.

• Unless otherwise stated, all logarithms are to base two.


1.) Given the following list of functions, group the functions based on their growth rates such that
two functions f and g belong to the same group if and only if f = O(g) and g = O(f ). After
grouping, rank the groups in increasing order of growth rate.

Provide a clear justification for:

• 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

(b.) (log n)log n

(c.) 42 log2 n (Note: 4 to the power of 2 log2 n)

(d.) nlog log n

(e.) n log(n15 ) + log n



(f.) n n7

(g.) n!
n
(h.) 22

(i.) log(n!)

Solution: [Write your answer here]


2.) Two students propose Divide & Conquer solutions for a problem of input size n. Student A’s
method involves solving 16 subproblems, each of size n/4, and requires O(n log n) time to merge
the results. In contrast, Student B’s approach uses 9 subproblems, each of size n/3, and requires
O(n2 ) time for the combination step.

(a.) What is the runtime of both Student A’s and Student B’s algorithms? Which one runs faster,
if either?

Solution: [Write your answer here]

(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).

Solution: [Write your answer here]


3.) Suppose you are given the following inputs: a sorted array A of n distinct integers, a lower
bound l, and an upper bound u. l and u may or may not appear in the array 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.

Solution: [Write your answer here]

(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.

Solution: [Write your answer here]

(c.) Give the runtime of your algorithm and explain the reasoning.

Solution: [Write your answer here]


4.) Given an n × n matrix, design a divide-and-conquer algorithm to find an entry that is greater
than or equal to all of its neighboring entries in O(n log n) time. If there are multiple entries that
are greater than or equal to all their neighbors, the algorithm only needs to find and return any
one of these entries.

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.

Solution: [Write your answer here]

(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.

Solution: [Write your answer here]

(c.) Give the runtime of your algorithm and explain the reasoning.

Solution: [Write your answer here]

You might also like