Data Str & Algorithm HW Solutions 14

Data Str & Algorithm HW Solutions 14 - volume...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
14 Chap. 2 Mathematical Preliminaries Induction hypothesis : T ( n 1)=2 n 1 1 . Induction step : T ( n )=2 T ( n 1)+1 = 2(2 n 1 1) + 1 =2 n 1 . Thus, as proved by mathematical induction, this formula is indeed the correct closed form solution for the recurrence. 2.29 (a) The probability is 0.5 for each choice. (b) The average number of “1” bits is n/ 2 , since each position has 0.5 probability of being “1.” (c) The leftmost “1” will be the leftmost bit (call it position 0) with prob- ability 0.5; in position 1 with probability 0.25, and so on. The number of positions we must examine is 1 in the case where the leftmost “1” is in position 0; 2 when it is in position 1, and so on. Thus, the expected cost is the value of the summation n X i =1 i 2 i . The closed form for this summation is 2 n +2 2 n , or just less than two. Thus, we expect to visit on average just less than two positions. (Stu- dents at this point will probably not be able to solve this summation, and it is not given in the book.) 2.30 There are at least two ways to approach this problem. One is to estimate the
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: volume directly. The second is to generate volume as a function of weight. This is especially easy if using the metric system, assuming that the human body is roughly the density of water. So a 50 Kilo person has a volume slightly less than 50 liters; a 160 pound person has a volume slightly less than 20 gallons. 2.31 (a) Image representations vary considerably, so the answer will vary as a result. One example answer is: Consider VGA standard size, full-color (24 bit) images, which is 3 640 480 , or just less than 1 Mbyte per image. The full database requires some 30-35 CDs. (b) Since we needed 30-35 CDs before, compressing by a factor of 10 is not suf f cient to get the database onto one CD. [Note that if the student picked a smaller format, such as estimating the size of a typical gif image, the result might well f t onto a single CD.]...
View Full Document

Ask a homework question - tutors are online