| | |
Summary: University of Wuppertal
Faculty C --- Department of Mathematics
Dr. Holger Arndt, Dipl.Math. Sigrid Fischer
Algorithms and Data Structures
WS 2004/2005
Exercise Sheet 2
Exercise 4 (6 p.) Show: If the recursive formula
T (n) = # O(1) if n = 1
k · T (n - 1) +O(n # ) if n > 1
with fixed k # N and # # 0 holds, then also does the explicit formula:
T (n) = # O(n #+1 ) if k = 1
O(k n
· n # ) if k > 1
Hint: You should get an intermediate result of the kind
T (n) = k n-1
· T (1) + (k n-2 + . . . + 1) · O(n # ).
Exercise 5 (6 p.) Consider the following algorithm
algorithm BR(n, a[0, · · · , n - 1])
if n > 1
then
|