EC330 Applied Algorithms and Data Structures For Engineers Fall 2018 Homework 3
EC330 Applied Algorithms and Data Structures For Engineers Fall 2018 Homework 3
EC330 Applied Algorithms and Data Structures For Engineers Fall 2018 Homework 3
Fall 2018
Homework 3
This homework has a written part and a programming part. Both are due at 8:59 am on
October 5. You should submit both parts on Blackboard. For the written part, you should
submit a single PDF file containing either typeset answers or scanned copies of hand-
written answers. Make sure you write your answers clearly. For the programming part,
your code should be easy to read and understand, and demonstrate good code design and
style. Your program must compile and run on the lab computers.
b) Give the tightest asymptotic upper bound (in 𝑂(∙)) you can obtain for the
following recurrences. Justify your answer. [5 pt each]
• 𝑇(𝑛) = 7𝑇(𝑛/3) + 𝑛!
• 𝑇(𝑛) = 2𝑇(𝑛/4) + 5 𝑛
• 𝑇 𝑛 = 20𝑇 𝑛/15 + 𝑛 log 𝑛
• 𝑇 𝑛 = 𝑇 𝑛 − 1 + 5 log 𝑛 , 𝑇(1) = 1
• 𝑇(𝑛) = (log 𝑛)𝑇(𝑛/2) + 1
• 𝑇(𝑛) = 𝑛(𝑇(𝑛/2))!
1
int j = i;
while (j < n) {
int k = 0;
while (k < n) {
k = k + 2;
}
j = j * 2;
}
i = i / 2;
}
b) Write down the recurrence relation of the following sorting algorithm. What is the
time complexity of this method (in 𝑂(∙) notation)? Justify your answer. [10 pt]