# Homework 1 - W07/CS592 Homework One Design and Analysis of...

This preview shows pages 1–2. Sign up to view the full content.

W07/CS592 Homework One Design and Analysis of Algorithms Due: January 30, 2007 There are five problems 1 Determine and use theta ( Θ ) notation to represent asymptotic upper and lower bounds for each T( n ) of the following functions or recurrence relations. Assume T( n ) is constant for n 4. You need to show clear steps to justify your answers. (1) T( n ) = 5T( n /4) + n 2 . (2) T( n ) = 4T( n ) + (lg n ) 2 (3) T( n ) = = n k k k 1 2 (4) T( n ) = = n k k k 1 lg 2 Suppose A[1. . n ] is a sorted sequence. The binary search algorithm is as follows. (refer to page 37, Exercise 2.3-5. BinSrch (A[], i , j , x ) if ( i > j ) then return 0 //unsuccessful search. else { mid = ( i + j )/2 if ( x = A[ mid ]) then return mid else if ( x < A[ mid ]) then return BinSrch(A[], i , mid -1, x ) else return BinSrch(A[], mid +1, j , x ); } End By calling BinSrch (A[], 1, n , x ), we can find if x is one of the elements in array A[1. . n ] or not. For any given

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 04/12/2008 for the course CS 592 taught by Professor Shen during the Winter '05 term at University of Missouri-Kansas City .

### Page1 / 3

Homework 1 - W07/CS592 Homework One Design and Analysis of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online