# HW2_Solution - HW1 SOLUTION 1. Chapter 2 Problem 2: Suppose...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: HW1 SOLUTION 1. Chapter 2 Problem 2: Suppose you have algorithms with the six running times listed below.(Assume these are the exact number of operations performed as a function of the input size n .) Suppose you have a computer that can perform 10 10 operations per second, and you need to compute a result in at most an hour of computation. For each of the algorithms, what is the largest input size n for which you would be able to get the result within an hour. (a) n 2 (b) n 3 (c) 100 n 2 (d) n log n (e) 2 n (f) 2 2 n Solution : The operations that a computer can perform within an hour is 10 10 * 3600 (a) n 2 = 10 10 * 3600, we have n = 6 * 10 6 (b) n 3 = 10 10 * 3600, we have n = 3 . 302 * 10 4 (c) 100 n 2 = 10 10 * 3600, we have n = 6 * 10 5 (d) n log n = 10 10 * 3600, we have n ≈ 1 . 291 * 10 12 (e) 2 n = 10 10 * 3600, we have n = log 2 (10 10 * 3600) ≈ 45 (f) 2 2 n = 10 10 * 3600, we have n = log 2 (log 2 (10 10 * 3600)) ≈ 5 Problem 3: Take the following list of functions and arrange them in ascending...
View Full Document

## HW2_Solution - HW1 SOLUTION 1. Chapter 2 Problem 2: Suppose...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online