{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# h2 - 1 COMPSCI 342-001 Data Structures and Algorithms(Fall...

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

1 COMPSCI 342-001 Data Structures and Algorithms (Fall 2011) Homework #2 (75 points), Due on 9/21/2011 (Wednesday), class time Q1(10 points): Asymptotic Notations (a)(6 points) Try to show 1 5 n 2 - 20 n - 100 = Θ( n 2 ) using the basic definition of Θ nota- tion. That is, to find positive constants c 1 ,c 2 ,n 0 such that c 1 n 2 1 5 n 2 - 20 n - 100 c 2 n 2 , n n 0 . (b)(2 points) Which one of the following is true? 1. 2 n = Θ(2 n ) 2. O ( n ) + Ω( n ) = Θ( n ) 3. If f ( n ) = O ( g ( n )) and both f ( n ) and g ( n ) are asymptotically positive, then f ( n ) + g ( n ) = O ( g ( n )) 4. f ( n ) = Ω( g ( n )) implies f ( n ) = ω ( g ( n )) (c)(2 points) Which one of the following sorting algorithms always has the running time recurrence equation T ( n ) = T ( n - 1) + n ? 1. Insertion sort 2. Bubble sort 3. Merge sort 4. Quick sort

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

View Full Document
2 Q2(15 points): Recurrence Given an array of n numbers, the following are two unfinished divide-and-conquer ap- proaches to find the maximal number. Please complete both approaches. First approach: Divide: Divide the array into one subarray with the first n - 1 numbers and the last number.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 6

h2 - 1 COMPSCI 342-001 Data Structures and Algorithms(Fall...

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

View Full Document
Ask a homework question - tutors are online