Analysis of Algorithms Homework 1: Algorithm Complexity and Recurrence Relations - Prof. A, Quizzes of Algorithms and Programming

A university homework assignment for a course on analysis of algorithms (cot5405). The assignment covers topics such as proving or disproving algorithm complexities, ordering functions according to asymptotic order, solving recurrence relations without using the master theorem, and solving recurrences using the master theorem. The assignment also includes a problem where the goal is to design a sub-linear algorithm to find the maximum safe height for dropping a laptop without breaking it.

Typology: Quizzes

Pre 2010

Uploaded on 12/08/2010

girishkhadke
girishkhadke 🇺🇸

4

(1)

2 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
COT5405 Analysis of Algorithms
Homework 1
Due Tuesday 15 Sep 2009, 1PM in TA office-hours.
Unless otherwise specified, each time you give an algorithm, you must state and justify its complexity.
You answer should begin with a high-level description of your solution in plain English, and then the
pseudo-code, if necessary. The English description should convey the core idea of your proposed solution,
and should include the proof of correctness (basically, showing why your algorithm works). You can
even omit the pseudo-code if 1) you think your English description is clear enough to specify both the
algorithm and its proof of correctness very precisely, and 2) the complexity is very much evident from
your English description. We attempt to grade the answer right after reading the English description,
and only in a few occasions we do look into the pseudo-code. Absolutely no pseudo-code without any
English description preceding that would be accepted. For knowing what pseudo-code is, please go to
the class website. Pseudo-codes that look like programs will be treated as programs only and will NOT
be looked into.
Every problem below has a page limit. Do not exceed that. And, page means one side of a page, so
if we say page limit is 1 page, we mean only one side of a page. If we say that the page limit is 2 pages,
then you can write on both sides of the page. If you think that the given page limit is too short, then
type your answer. Any portion of the answer that exceeds the page limit is simply ignored. Each of the
following 8 questions must be answered on a fresh page.
1
pf3

Partial preview of the text

Download Analysis of Algorithms Homework 1: Algorithm Complexity and Recurrence Relations - Prof. A and more Quizzes Algorithms and Programming in PDF only on Docsity!

COT5405 Analysis of Algorithms

Homework 1

Due Tuesday 15 Sep 2009, 1PM in TA office-hours.

Unless otherwise specified, each time you give an algorithm, you must state and justify its complexity. You answer should begin with a high-level description of your solution in plain English, and then the pseudo-code, if necessary. The English description should convey the core idea of your proposed solution, and should include the proof of correctness (basically, showing why your algorithm works). You can even omit the pseudo-code if 1) you think your English description is clear enough to specify both the algorithm and its proof of correctness very precisely, and 2) the complexity is very much evident from your English description. We attempt to grade the answer right after reading the English description, and only in a few occasions we do look into the pseudo-code. Absolutely no pseudo-code without any English description preceding that would be accepted. For knowing what pseudo-code is, please go to the class website. Pseudo-codes that look like programs will be treated as programs only and will NOT be looked into. Every problem below has a page limit. Do not exceed that. And, page means one side of a page, so if we say page limit is 1 page, we mean only one side of a page. If we say that the page limit is 2 pages, then you can write on both sides of the page. If you think that the given page limit is too short, then type your answer. Any portion of the answer that exceeds the page limit is simply ignored. Each of the following 8 questions must be answered on a fresh page.

Problems

  1. (1/2 page per part) Prove or disprove.

(a) n^1.^001 + n log n = θ(n^1.^001 ) (b) n^3 /log n = ω(n^2 )

  1. (1/2 page) Use equivalence (≡) and less than (<) to order the below functions according to asymptotic order. n! n lg n (lg n)n^ (1 + 1/11)n^ lg∗^ n lg (n!) 2 lg n/^100 2 n^ log 10 n en^1 4 lg n^42 lg n^ nn/lg n^ n^1 /^10
  2. (1/2 page per part) Solve the given recurrence relations with-out using masters theorem.

(a) T (n) = 2T (n/2) + n/log n (b) T (n) = T (

n) + 1 (c) T (n) = 2T (n/3) + T (n/4) + n

  1. (1/2 page per part) Solve the given recurrences. Use master theorem if applicable.

(a) T (n) =

nT (

n) + n (b) T (n) = 4T (n/4) + 5n (log n)^2 + n

n (c) T (n) = 2T (n/2) + n (log n)^3

  1. (1 page) Say you work for a laptop manufacturing company who wants to develop the most durable laptop. They test the durability by dropping the laptop on a hard surface from n different heights which are in increasing order. You have to find the maximum height from which you can drop the laptop without breaking it. The company lets you break at most m laptops for obvious reasons. Design a strategy which is sub-linear in the number of drops. Note that if you can break log n laptops, you can use a binary search strategy. Also, if you can perform O(n) drops the maximum height can be found by breaking just one laptop with a linear scan. However, the company is ruling out these two options for budget and time constraint.

(a) Design an o(n) (small-o) algorithm to find the maximum safe height when m = 2. (b) For each m > 2, design an algorithm for finding the maximum safe height using at most m laptops. Let gm(n) be the number of drops using this algorithm. Then your algorithm should satisfy that gm(n) = o(gm− 1 (n)) (small-o) for each m.