0% found this document useful (0 votes)
136 views2 pages

Introduction To Algorithms CS430

This document contains 6 homework problems for an algorithms class. Problem 1 asks to characterize optimal leaf weights and establish a recurrence for lopsided search trees with costs of 3 and 1. Problem 2 sets up recurrences for solving a list problem and asks to solve recurrences of the form T(n) = 4T(n-1) + 2n and T(n) = 8T(n-1) - 16T(n-2). Problem 3 asks to use recursion trees to solve T(n) = T(n-c) + T(c) + √n. Problems 4-6 ask to solve recurrences of the form T(n) = T(f(n)) +

Uploaded by

joanne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
136 views2 pages

Introduction To Algorithms CS430

This document contains 6 homework problems for an algorithms class. Problem 1 asks to characterize optimal leaf weights and establish a recurrence for lopsided search trees with costs of 3 and 1. Problem 2 sets up recurrences for solving a list problem and asks to solve recurrences of the form T(n) = 4T(n-1) + 2n and T(n) = 8T(n-1) - 16T(n-2). Problem 3 asks to use recursion trees to solve T(n) = T(n-c) + T(c) + √n. Problems 4-6 ask to solve recurrences of the form T(n) = T(f(n)) +

Uploaded by

joanne
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Introduction To Algorithms

CS430
Fall 2015
HomeWork 2
Due 14th September

1. Consider lopsided trees with costs 3 and 1 on the left and right branches, respectively,
of the search tree. Characterize the weights (costs) at the leaves of the optimal trees.
Establish a recurrence for the maximum number of leaf nodes of cost w(No need to
solve the recurrence). (20 pts)
2. (15 pts) (i) Set up time complexity for the following programs and solve the following
recurrences:
L = (l1 , l2 . . . ln ) is a list of size n
SolveProb(L)
{
If n > 1{
SolveProb(L1 = (l1 , l2 . . . ln1 ))
SolveProb(L2 = (l2 , l3 . . . ln ))
SolveProb(L3 = (l2 , l3 , . . . ln1 )) }
}
(ii) Solve the following recurrence:
T (n) = 4T (n 1) + 2n , n > 0
with T (0) = 1.
(iii) Solve
T (n) = 8T (n 1) 16T (n 2), n > 1
with T (0) = 2, T (1) = 10
3. (5pts) Use the recursion tree method to solve

T (n) = T (n c) + T (c) + n
where c is a constant and T (c) = c
4. (10pts) Solve the recurrence
T (n) = T (8n/9) + T (n/18) + f (n)
when f (n) = n and f (n) = n2 .
5. (10pts) Solve the recurrence
T (n) = T (8n/9) + T (3n/18) + f (n)
when f (n) = log n and f (n) = n2 .
1

6. (10pts) Solve the following recurrences where:


T (i) = 1; i = 1...10
(a) T (n) = T (logn) + 3
(b) T (n) = T (logn) + 3n

You might also like