This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 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 such that c 1 n 2 1 5 n 2- 20 n- 100 c 2 n 2 , n n . (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 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.proaches to find the maximal number....
View Full Document