# Recurrence Running Time

Give asymptotic upper and lower running time bounds for T(n) for each of the recurrences. Assume that T(n) is constant for n <= 2. Make bounds as tight as possible, and justify solutions.

a) T(n) = 2*T(n/2) + n^3

b) T(n) = T(9n/10) + n

c) T(n) = 16*T(n/4)+n^2

d) T(n) = 7*T(n/3) + n^2

e) T(n) = 7*T(n/2) + n^2

© BrainMass Inc. brainmass.com October 24, 2018, 7:18 pm ad1c9bdddfhttps://brainmass.com/computer-science/data/recurrence-running-time-63537

#### Solution Summary

Recurrence running times are analyzed. The asymptotic upper and lower running time bounds for functions are determined.

Discrete structures

6. A string that contains only 0s 1s and 2s is called a ternary string

a) find a recurrence relation for the number of ternary strings that contain two consecutive 0s

b) what are the initial conditions

c) how many ternary strings of length six contain two consecutive 0s

The next 3 problems deal with a variation of the Josephus problem described by Graham, Knuth, and Patashnik in [GrKnPa94].? This problem is based on an account by the historian Flauvius Josephus, who was part of a band of 41 Jewish rebels trapped in a cave by the Romans during the Jewish-Roman war of the first century.? The rebels pre-ferred suicide to capture; they decided to form a circle and to repeatedly count off around the circle, killing every 3rd rebel left.? However, josephus and another rebel did not want to be killed this way; they determined the positions where they should stand to be the last two rebels remaining alive.? The variation we consider begins with n people, numbered 1 to n, standing around a circle.? In each stage, every second person still left alive is eliminated until only one survives.? We denote the number of the survivor by J(n).

7) Determine the value of J(n) for each integer n with 1 <= n <= 16.? Use these values to conjecture a formula for J(n).? Hint: Write n=2^m +k, where m is a nonnegative integer and k is a nonnegative integer less than 2^m.

8) Show that J(n) satisfies the recurrence relation J(2n) = 2J(n) - 1 and J(2n+1) = 2J(n) + 1, for n >= 1, and J(1) = 1.

9) Use mathematical induction to prove that the formula you conjectured in exercise 50, making use of the recurrence relation from the previous exercise.

10) a. Assume that in the average case, the running time for Quicksort is f(n) = 2f(n/2)+ n. Use the Master Theorem to estimate its closed-form running time.

b. Do the same for Slowsort, whose running time is f(n) = 4f(n/2)+n.

View Full Posting Details