Common recurrence types in algorithm analysis

Assignment Help Engineering Mathematics
Reference no: EM131005952

Consider common recurrence types in algorithm analysis: Decrease-by-One, Decrease-by-a-Constant Factor, and Divide-by-Conquer.

1. A decrease-by-one algorithm solves a problem by exploiting a relationship between a given instance of size n and a smaller instance of size n - 1. Specific examples include recursive evaluation of n! and insertion sort. The recurrence equation for finding the time efficiency of such algorithms has the following form:

T(n)= T(n - 1) + f(n),

Where function f(n) accounts for the time needed to reduce an instance to a smaller one and to extend the solution of the smaller instance to a solution of the larger instance.

Show     (a) T(n) = T(0) + ∑j=1n f(j)

For a specific function f(x), the sum + ∑j=1n f(j) can usually be either computed exactly or its order of growth ascertained.

(b)          if fin) =1,              ∑j=1n f(j) = n.

(c)           if f(n) = log n,     ∑j=1n f(j) εΘ(nlogn).

(d)          if f(n)= nk             ∑j=1n f(j) εΘ(nk+1).

2. A decrease-by-a-constant-factor algorithm solves a problem by reducing its instance of size n to an instance of size nib (b = 2 for most but not all such algorithms), solving the smaller instance recursively, and then, if necessary, extending the solution of the smaller instance to a solution of the given instance. Examples include binary search, exponentiation by squaring, Russian peasant multiplication, and the fake-coin-problem. The recurrence equation for finding the time efficiency of such algorithms has the following form:

T(n) = T(n/b) + f(n),

where b > 1 and function f(n) accounts for the time needed to reduce an instance to a smaller one and to extend the solution of the smaller instance to a solution of the larger instance. Strictly speaking, this recurrence equation is valid only for n = bk, k= 0, 1, 2,.....  For values of n that are not powers of b, there is typically some round-off, usually involving the floor and/or ceiling functions.

Show

(a) By considering n = bk k= 0, 1, 2,..... , and applying backward substitutions to this recurrence equation,

T(n) = T(1) + ∑j=1k f(bj)

For a specific function f(x), the sum ∑j=1k f(bj)  can usually be either computed exactly or its order of growth ascertained.

(b)          if f(n)= 1, ∑j=1k f(bj)  = logbn.

(c)           If f(n)= n, ∑j=1k f(bj)  = b(n-1)/b-1

3. A divide-and-conquer algorithm solves a problem by dividing its given instance into several smaller instances, solving each of them recursively, and then, if necessary, combining the solutions to the smaller instances into a solution to the given instance. Assuming that all smaller instances have the same size nib, with a of them being actually solved, we get the following recurrence valid for n = bk, k = 0, 1, 2, .....

T(n) = aT(n/b) + f(n),

where a ≥ 1, b ≥ 2, and f(n) is a function that accounts for the time spent on dividing the problem into smaller ones and combining their solutions.

Show that the following formula is the solution to this recurrence for n = bk,

T(n) = nlogba [ T(1) + ∑j=1logbn f(bj)/aj],

The order of growth of solution T(n) depends on the values of the constants a and b and the order of growth of the function f(n).

4. Use the divide-and-conquer integer multiplication algorithm to multiply the two binary integers 10011011 and 10111010.

5. Using backward substitution, find the solutions for the following relations

(a)          T(n) = 3T(n/2) + Θ(n), and

(b)          T(n) = T(n -I) + Θ(1).

6. You are given an array of n elements, and you notice that some of the elements are duplicates; that is, they appear more than once in the array. Show how to remove all duplicates from the array in time 0(n log n),

7. Here we look at an alternative algorithm based on divide-and-conquer.

(a)                                      - 2 gcd(a/2, b/2)      if a, b are even

                gcd (a, b) =          gcd(a, b/2)             if a is odd, b is even

                                          gcd((a - b)/2, b)      if a, b are odd

Show this rule is true.

(b) Give an efficient divide-and-conquer algorithm for finding greatest common divisor.

(c) How does the efficiency of your algorithm compare to Euclid's algorithm if a and b are n-bit integers? (in particular, since n might be large you cannot assume that basic arithmetic operations like addition take constant time.)

Reference no: EM131005952

Questions Cloud

Compares and contrasts various forms of compensation : Write a paper that compares and contrasts various forms of compensation, incentives, and benefits. What are the advantages and disadvantages to the employer offering these different benefits
Calculate the amount of investment in this economy : In a small open economy, if exports equal $40 billion, imports equal $10 billion, and domestic national saving equals $35 billion. (a) Calculate the amount of investment in this economy. (b) How much is the net capital outflow? (c) What will happen t..
Prove that the exists a line parallel to the y-axis : Consider the shape pictured below. Prove that there exists a line parallel to the y-axis that divides the area of the shape exactly in half that is, such that half of the area is on the left side of the line.
Resolving or diminishing society common problems : Human Conflict - the nature and causes there of. The best or best possible cooperative social arrangements, capable of resolving or diminishing society's common problems
Common recurrence types in algorithm analysis : How does the efficiency of your algorithm compare to Euclid's algorithm if a and b are n-bit integers and common recurrence types in algorithm analysis
Sketch and describe the quadric surface : Use traces to sketch and describe the quadric surface. x2 + 4y2 - 25z2 = 100. At what points does the curve r (t) = ti + (4t-t2)k intersect the parabolid z = x2 + 3y2?
How the physical cognitive emotional concepts you learned : Explain how the physical, cognitive, emotional, and social developmental concepts you learned about this week apply to the person you have in mind
Find symmetric equations for the line through given points : Find symmetric equations for the line through the points p (1, 1, -3) and Q (2,-1,1). Find an equation for the plane through P (2, 0, 1) and parallel to the line x = 3t, y = 2 - t, z = 3 + 4t.
What effect do unions have on worker productivity : What effect do unions have on worker productivity? What impact have deregulation and global competition had on bargaining? Discuss the advantages and disadvantages of using seniority as a basis of pay level, promotion, and job security

Reviews

Write a Review

Engineering Mathematics Questions & Answers

  Training sessions on problem solving

A company wants to offer their employees a three-day training program on team building and a two-day program on problem solving. They have requested at least 8 training sessions on team building and at least 10 training sessions on problem solving..

  Considering the comfort and safety of passengers

When considering the comfort and safety of passengers why are women ignored in this case?

  There are 60 regular attendees and no trainees present at

the speedem-feedem airline must decide how many new flight attendants to hire and train over the next six months. the

  Just build the payoff matrix model

Just build the payoff matrix model in each caseb.)compute a regret (opportunity loss) matrix.HINT:Your payoff matrix should have six strategies and nine states of nature.

  Interpret the null hypothesis using your t-statistic

Interpret the null hypothesis using your t-statistic. Interpret the null hypothesis using p-value. Interpret your confidence interval and test the null hypothesis using confidence interval.

  Evaluate lim sup ek

Evaluate lim sup Ek

  Optimization equation and constraint equations

Make a table (no not that type of table, the other type) that summarizes the above information. Write down the optimization equation and the constraint equations and label them as such.  Make sure your write down all of the constraint equations.  T..

  Calculate the normal vector of the hyperplane

Please point out the support vectors in the training points. Calculate the normal vector of the hyperplane

  Examine an empirical research question in economics

1. The term paper should examine an empirical research question in Economics. 2.The term paper should consist of a full documentation of the project in the form of Word and script file containing the computation codes.

  Calculate the sample average

a. Calculate the sample average b. Calculate the sample standard deviation c. Based only on this information do you have a normally distributed process?

  Determine the new optimal solution

Assume the overall utility of the current favorite cereal for children 1-4 is 70, and the overall utility of the current favorite cereal for children 5-7 is 80. Modify the linear programming model used to determine the product design that will max..

  Testing claims about proportions

Test the given claim. Identify the null hypothesis, alternative hypothesis, test statistic, P-value or critical value(s), conclusions about the null hypothesis, and final conclusion that addresses the original claim. Use the P-value method. Use th..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd