Hw3Fl05Alg

Hw3Fl05Alg - up characteristic equation T(N = T(N-1 T(N-2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 5211/4081 Algorithm Analysis HomeWork 3 Due: 9/29/05 Points: 15/25 .1. Write the recurrence equation for time complexity of the following algorithm and solve it using Master Theorem. [5] Algorithm Useless (Global array A, index first , index last ) .(1) if first = = last .(2) return Else { .(3) for int i := first through last do .(4) for int j := last through first do .(5) global array B[j] := A[i]*A[j]; .(6) int mid1 := first+(last – first)/3; .(7) int mid2 := first+ 2*(last – first)/3; .(8) Useless(A, first, mid1); .(9) Useless(A, mid1 +1, mid2); .(10) Useless(A, mid2 +1, last); }; End if; End algorithm. [For lines 3 through 5 you may use the final asymptotic complexity function rather than showing the calculation via the summation series. Ignore the constant-time steps, e.g., line 6 and 7, in setting up the recurrence equation. If you are playing with any particular problem size, then use n=3^k for some integer k, e.g., n=27.] .2. Solve the following homogeneous recurrence equation for general solution by setting
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: up characteristic equation: T(N) = T(N-1) + T(N-2) [ Note that this is the Fibonacci number and not the complexity of calculating it.] The roots of the quadratic equation ax 2 + bx + c = 0 are (-b + sqareroot(b 2 – 4ac))/2a and (-b - sqareroot(b 2 – 4ac))/2a. [5] GRAD QUSETION 2b. Set up the characteristic equation for: T(N) = T(N-1) + T(N-2) +1 [5] UNDERGRAD QUESTION: 3. Solve the following recurrence equation for general solution by setting up its characteristic equation, and then mention the order (theta) function for that solution. T(N) = 2T(N-1) - T(N-2) [5] GRAD QUESTION 3. Solve the following recurrence equation for general solution by setting up its characteristic equation, and then mention the order (theta) function for that solution. T(N) = 2T(N-1) - T(N-2) +1 [5] .4. GRAD QUESTION: Analyze average case complexity of QuickSelect algorithm by setting up its recurrence equation and then solving it by telescopic method. [5]...
View Full Document

This note was uploaded on 02/10/2012 for the course CSE 5211 taught by Professor Dmitra during the Spring '12 term at FIT.

Page1 / 2

Hw3Fl05Alg - up characteristic equation T(N = T(N-1 T(N-2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online