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

CMSC 351 Homework 2: Algorithms and Complexity - Prof. Clyde P. Kruskal, Assignments of Algorithms and Programming

The summer 2008 edition of homework 2 for the cmsc 351 course at the university of california, berkeley. The homework covers various topics in algorithms and complexity, including big o notation, big theta notation, and the analysis of insertion sort. Students are asked to solve problems related to the efficiency of different algorithms and the comparison of their complexities.

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-36r
koofers-user-36r 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download CMSC 351 Homework 2: Algorithms and Complexity - Prof. Clyde P. Kruskal and more Assignments Algorithms and Programming in PDF only on Docsity! Summer 2008 CMSC 351: Homework 2 Clyde Kruskal Due at the start of class Wednesday, June 11, 2008. There are FOUR problems. Problem 1. Professor Hilbert invents a program that uses exactly 100n4 operations to solve the borogove problem of size n. Professor Poincare invents a program that uses 2n/106 operations to solve the same problem. (a) Assume that you are willing to run Hilbert’s program for some specific amount of time. Assume that your computer speed increases by a factor of 20. How much larger a problem can you solve in the same amount of time? Show your work. (b) Assume that your computer executes one billion operations per second. Approx- imately how large a problem can you solve in a year? Show your work (but not the arithmetic). (c) Assume that you are willing to run Poincare’s program for some specific amount of time. Assume that your computer speed increases by a factor of 20. How much larger a problem can you solve in the same amount of time? Show your work. (d) Assume that your computer still executes one billion operations per second. Ap- proximately how large a problem can you now solve in a year? Show your work (but not the arithmetic). (e) Whose program should you use if you are going to run it for a year? (f) For approximately what values of n is Professor Hilbert’s program faster than Professor Poincare’s? Show your work. Problem 2. Show the following. In each of (a), (b), and (c) state specific values of the constants (e.g. c1, c2, n0) you used to satisfy the conditions, and show how you arrived at the values. (a) 3n2 + 4n − 5 = O(n2 − 3n + 1) (b) 2n3 − 5n2 + 3 = Θ(n3) (c) 2n2 + 5n(lg n)3 = O(n2) [Hint: Find n0 such that (lg n) 3 ≤ n, for all n ≥ n0.] (d) n log n = o(n1.5) Problem 3. For each pair of expressions (A,B) below, indicate whether A is O, o, Ω, ω, or Θ of B. Note that zero, one or more of these relations may hold for a given pair; list all correct ones. A B (a) n100 2n (b) (log n)12 √ n (c) √ n ncos(πn/8) (d) 10n 100n (e) nlog n (log n)n (f) log (n!) n log n
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved