Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

questions 14, 15, 16 and 17 230 3/Algorithms a) Show that this algorithm uses O(n3) comparisons to b) 1000n compute the matrix M. d) 1000n2

image text in transcribed

questions 14, 15, 16 and 17

230 3/Algorithms a) Show that this algorithm uses O(n3) comparisons to b) 1000n compute the matrix M. d) 1000n2 b) Show that this algorithm uses 2(n) comparisons to compute the matrix M. Using this fact and part (a), conclude that the algorithms uses (n*) comparisons. Hint: Only consider the cases where i s /4 and 17. What is the largest for which one can solve within a minute using an algorithm that requires f (n) bit op- erations, where each bit operation is carried out in 10 seconds, with these functions f (n)? a) log logn d) 1000000 e) n j3n/4 in the two outer loops in the algorithm.] 13. The conventional algorithm for evaluating a polynomial anx" +an-ix"-' + . . . + aix +ao at x = c can be ex b) log n c) logn pressed in pseudocode by procedure pohnomal(c, ao, ai, n : real numbers) 18. How much time does an algorithm take to solve a prob- lem of size n if this algorithm uses 2n 2" operations, each requiring 10-9 seconds, with these values of n? for i := l to n power := power * c y:= y + ai * power 19. How much time does an algorithm using 250 operations return y (ya+an-1c++ac +aol where the final value of y is the value of the polynomial need if each operation takes these amounts of time? a) 10-6 12 10-ess0 20. What is the effect in the time required to solve a prob- lem when you double the size of the input from n to 2n assuming that the number of milliseconds the algorithm uses to solve the problem with input size n is each of these function? [Express your answer in the simplest form pos- sible, either as a ratio or a difference. Your answer may be a function of n or a constant.] a) log log n b log n a) Evaluate 3x2 +x +1 at x 2 by working through each step of the algorithm showing the values assigned at each assignment step. b) Exactly how many multiplications and additions are used to evaluate a polynomial of degree n at x = c? Do not count additions used to increment the loop c) 100n variable.) n logn 14. There is a more efficient algorithm (in terms of the num- ber of multiplications and additions used) for evaluating polynomials than the conventional algorithm described in the previous exercise. It is called Horner's method. This pseudocode shows how to use this method to find the 8) 2" 21. What is the effect in the time required to solve a problem when you increase the size of the input from n to1 assuming that the number of milliseconds the algorithm uses to solve the problem with input size n is each of these function? [Express your answer in the simplest form pos- sible, either as a ratio or a difference. Your answer may be a function of n or a constant.] value ofanx" +an-ir"-i+ +alx+a0 at x = c y := an b) 100n e) g) n! a) Evaluate 3x2 +x +1 at x 2 by working through each step of the algorithm showing the values assigned 22. Determine the least number of comparisons, or best-case a) required to find the maximum of a sequence of n in- b) used to locate an element in a list of n terms with a c) used to locate an element in a list of n terms using a at each assignment step. b) Exactly how many multiplications and additions are used by this algorithm to evaluate a polynomial of degree n at c? Do not count additions used to tegers, using Algorithm 1 of Section 3.1 increment the loop variable.) search. 15. What is the largest n for which one can solve within one second a problem using an algorithm that requires f (n) it operations, where each bit operation is carried out in binary search. 23. Analyze the average-case performance of the linear search algorithm, if exactly half the time the element x is not in the list and if x is in the lis s equally likely to 0 seconds, with these functions f(n)? n logn be in any position. 16. What is the largest n for which one can solve within a day using an algorithm that requires f (n) bit where each bit operation is carried out in 101 seconds, with these functions f(n)? 24. An algorithm is called optimal for the solution of a prob- lem with respect to a specified operation if there is no algorithm for solving this problem using fewer opera

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

1. Describe the types of power that effective leaders employ

Answered: 1 week ago