Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Engineering Mathematics Expert

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.)

Engineering Mathematics, Engineering

  • Category:- Engineering Mathematics
  • Reference No.:- M91721688

Have any Question?


Related Questions in Engineering Mathematics

Assignment - lp problemsthe data for all the problems in

Assignment - LP problems The data for all the problems in this HW are included in the LP_problems_xlsx spreadsheet. Problem 1 - Cash Planning A startup investment project needs money to cover its cash flow needs. At the ...

Problem 1given a sequence xn for 0lenle3 where x0 1 x1 1

Problem # 1: Given a sequence x(n) for 0≤n≤3, where x(0) = 1, x(1) = 1, x(2) = -1, and x(3) = 0, compute its DFT X(k). (Use DFT formula, don't use MATLAB function) Use inverse DFT and apply it on the Fourier components X ...

I have these questions for a homework assignment and have

I have these questions for a homework assignment and have to show work. This works with MIPS coding language and is the class Introduction to Computer Architecture. 1. Find the 2's complement representation (in 32-bit he ...

Question a signal starts at point x as it travels to point

Question : A signal starts at point X. As it travels to point Y, it loses 8 dB. At point Y, the signal is boosted by 10 bB. As the signal travels to point Z, it loses 7 dB. The dB strength of the signal at point Z is -5 ...

Q undirected vs directed connectivitya prove that in any

Q: Undirected vs. directed connectivity. (a) Prove that in any connected undirected graph G = (V, E) there is a vertex v ? V whose removal leaves G connected. (Hint: Consider the DFS search tree for G.) (b) Give an examp ...

Problem -consider a closed convex set x sub rd a function h

Problem - Consider a closed convex set X ⊂ R d , a function H : X x Ξ ι→ R d , and a deterministic nonnegative sequence {α n } such that n=0 ∑ ∞ α n = ∞ and n=0 ∑ ∞ (α n ) 2 = ∞. Consider an inner product (·, ·) on R d , ...

All these questions should be answered in matlab 1 generate

All these questions should be answered in MATLAB !!! 1. Generate a set of 3 random patterns of dimension 12 where each value is +1 or -1.(3 random 12*12 matrix) 2. Create a 12-unit Hopfield network (a 12x12 matrix) from ...

Assignment -1 let t and or 0 1 be a boolean algebradefine

Assignment - 1. Let (T, ∧, ∨,', 0, 1) be a Boolean Algebra. Define ∗ : T × T → T and o : T × T → T as follows: x ∗ y := (x ∨ y)' x o y := (x ∧ y)' (a) Show, using the laws of Boolean Algebra, how to define x ∗ y using on ...

Question suppose that g is a directed graph in class we

Question : Suppose that G is a directed graph. In class we discussed an algorithm that will determine whether a given vertex can reach every other vertex in the graph (this is the 1-to-many reachability problem). Conside ...

Question a suppose that you are given an instance of the

Question : (a) Suppose that you are given an instance of the MST problem on a graph G, with edge weights that are all positive and distinct. Let T be the minimum spanning tree for G returned by Kruskal's algorithm. Now s ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As