Docsity

Homework Set 1 - Algorithm Analysis and Design | CPSC 5115G, Assignments of Computer Science

Toggle sidebar
bg1
CPSC 5115 Algorithm Analysis and Design
Homework Set 1 Due Wednesday, September 22, 2004
DON’T DO ANY WORK OR PUT ANSWERS ON THIS SHEET OF PAPER.
JUSTIFY ALL OF YOUR ANSWERS BY SHOWING YOUR WORK.
1. Solve the following recursions
a) T(n) = 3T(n/27) + n3.
b) T(n) = 3T(n/27) + n2.
a) T(n) = 3T(n/27) + n + 15.
2. Find the time complexity of the following functions.
a) T(N) = 2T(N/4) + 7N
b) T(N) = 8T(N/2) + 3N2 + 5N + 6
c) T(N) = 9T(N/3)
3. What is the time complexity for the following procedure?
Express as a function of n.
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
{ a[i][j] = 0 ;
for (int k = 0; k < n; k++)
a[i][j] = a[i][j] + b[i][k] * c[k][j] ;
}

Partial preview of the text

Download Homework Set 1 - Algorithm Analysis and Design | CPSC 5115G and more Assignments Computer Science in PDF only on Docsity!

CPSC 5115 Algorithm Analysis and Design

Homework Set 1 Due Wednesday, September 22, 2004

DON’T DO ANY WORK OR PUT ANSWERS ON THIS SHEET OF PAPER.

JUSTIFY ALL OF YOUR ANSWERS BY SHOWING YOUR WORK.

  1. Solve the following recursions a) T(n) = 3T(n/27) + n^3. b) T(n) = 3T(n/27) + n^2. a) T(n) = 3T(n/27) + n + 15.
  2. Find the time complexity of the following functions. a) T(N) = 2T(N/4) + 7N b) T(N) = 8T(N/2) + 3N^2 + 5N + 6 c) T(N) = 9T(N/3)
  3. What is the time complexity for the following procedure? Express as a function of n. for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { a[i][j] = 0 ; for (int k = 0; k < n; k++) a[i][j] = a[i][j] + b[i][k] * c[k][j] ; }