Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Homework 1 for 22C: Design and Analysis of Algorithms, Spring 2006 - Prof. Kasturi Varadar, Assignments of Algorithms and Programming

The instructions and problems for homework 1 in the 22c: design and analysis of algorithms course offered in spring 2006. Students are expected to complete the assignments independently and without external help, but they may discuss the problems with their classmates. Four problems, each worth a certain number of points.

Typology: Assignments

Pre 2010

Uploaded on 03/10/2009

koofers-user-ot5-2
koofers-user-ot5-2 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
22C: 231 Design and Analysis of Algorithms
Spring 2006
Homework 1
Due on Tuesday, February 14
You are expected to do the homework assignments on your own without consulting hu-
man and non-human sources (like the web, books other than the textbook) for the solutions.
You are welcome to discuss the homeworks with your classmates, but you are not allowed to
take away from the discussion any written record, electronic or otherwise, of the discussion.
1. [12 points] Suppose that we change our deterministic linear time algorithm for se-
lection as follows. Instead of computing our partitioning element by dividing into
groups of 5 and choosing the median from the medians within each group, we divide
into groups of 9 and choose the median from the medians within each group. Do we
still obtain a linear time algorithm? Argue by setting up a recurrence for the running
time and justifying informally whether this recurrence leads to an O(n) bound on the
running time.
2. [12 points] Solve the following recurrence, that is, express T(n) as Θ(nα) for the
appropriate α.
T(n) = 7T(n/2) + nif n2
T(n) = 1 if n < 2.
You should derive your solution by expanding the recurrence, noticing a pattern,
and adding up a series, just as we did in class. There is no need for a more formal
derivation.
3. [13 points] Exercise 4 of chapter 5 of the book. For a hint, read the applications that
are described in the book for convolutions.
4. [13 points] Exercise 6 of chapter 5 of the book. Review Solved Exercise 1 in Chapter
5 if needed. (You can assume your favorite representation for the complete binary
tree.)
1

Partial preview of the text

Download Homework 1 for 22C: Design and Analysis of Algorithms, Spring 2006 - Prof. Kasturi Varadar and more Assignments Algorithms and Programming in PDF only on Docsity!

22 C : 231 Design and Analysis of Algorithms

Spring 2006

Homework 1

Due on Tuesday, February 14

You are expected to do the homework assignments on your own without consulting hu- man and non-human sources (like the web, books other than the textbook) for the solutions. You are welcome to discuss the homeworks with your classmates, but you are not allowed to take away from the discussion any written record, electronic or otherwise, of the discussion.

  1. [12 points] Suppose that we change our deterministic linear time algorithm for se- lection as follows. Instead of computing our partitioning element by dividing into groups of 5 and choosing the median from the medians within each group, we divide into groups of 9 and choose the median from the medians within each group. Do we still obtain a linear time algorithm? Argue by setting up a recurrence for the running time and justifying informally whether this recurrence leads to an O(n) bound on the running time.
  2. [12 points] Solve the following recurrence, that is, express T (n) as Θ(nα) for the appropriate α.

T (n) = 7 T (n/2) + n if n ≥ 2 T (n) = 1 if n < 2.

You should derive your solution by expanding the recurrence, noticing a pattern, and adding up a series, just as we did in class. There is no need for a more formal derivation.

  1. [13 points] Exercise 4 of chapter 5 of the book. For a hint, read the applications that are described in the book for convolutions.
  2. [13 points] Exercise 6 of chapter 5 of the book. Review Solved Exercise 1 in Chapter 5 if needed. (You can assume your favorite representation for the complete binary tree.)