This ?le contains the exercises, hints, and solutions for Chapter 2 of the book Introduction to the Design and analysis of Algorithms, 2nd edition, by A. Levitin. The problems that power be challenging for at least some students argon pronounced by ; those that aptitude be di?cult for a majority of students argon tag by . Exercises 2.1 1. For each of the following algorithms, indicate (i) a inherent surface metric for its inputs; (ii) its basic movement; (iii) whether the basic mathematical process count crowd out be di?erent for inputs of the same size: a. reckoning the sum of n rounds b. computing n! c. ?nding the largest dismantle in a diagnose of n numbers d. Euclids algorithm e. sieve of Eratosthenes f. pen-and-pencil algorithm for multiplying two n-digit decimal integers 2. a. give in the de?nition-based algorithm for adding two n-by-n matrices. What is its basic operation? How many streak is it performed as a function of the matrix order n? As a function of the total number of elements in the input matrices? b. Answer the same questions for the de?nition-based algorithm for matrix multiplication. 3. string a variation of sequential search that scans a tilt to return the number of occurrences of a given search get wind out in the list. Will its e?ciency di?er from the e?ciency of unstained sequential search? 4. a.
Glove option at that place are 22 gloves in a drawer: 5 pairs of rosy gloves, 4 pairs of yellow, and 2 pairs of green. You select the gloves in the swarthiness and can check them only aft(prenominal) a selection has been made. What is the smallest number of gloves you need to select to have! at least nonpareil matching pair in the best eccentric person? in the pommel case? (after [Mos01], #18) b. Missing socks Imagine that after washables 5 distinct pairs of socks, you discover that two socks are missing. Of course, you would resembling to have the largest number of complete pairs remaining. Thus, you are left with 4 complete pairs in the best-case scenario and with 3 complete pairs in the whisk case. Assuming that the probability of...If you want to get a respectable essay, order it on our website: OrderCustomPaper.com
If you want to get a full essay, visit our page: write my paper
No comments:
Post a Comment