CSE 326
HW 1
Related reading: Chapters 2 & 3
Due date: Friday, April 6, 2001 in class
Total points: 40 points + 5 possible extra credit points
Homework #1
i. sum = 0;
for( i = 0; i< n; i++ )
for( j = 0; j < i; j++)
sum++;
ii. sum = 0;
for( i = 0; i< n; i++ )
for( j = 0; j < i * i; j++)
for( k = 0; k < j; k++)
sum++;
b. Extra Credit: In addition to time complexity, we are often interested in the space requirement of an algorithm. Analyze the space complexity of the above code segments and give your final result in Big-Oh.
T(n) =
b. Compare the recurrence equation below to the equation in part a., which of them is asymptotically larger?
T(n) =
c. Solve the following recurrence equation.
3T(n/2) + n if n > 0
T(n) = 0 otherwise
b. What is the time complexity of your algorithm?