{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# assign1 - CS4311 Design and Analysis of Algorithms Homework...

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

CS4311 Design and Analysis of Algorithms Homework 1 Due: 11:10 am, March 13, 2008 (before class) 1. (15%) Give asymptotic upper bound for T ( n ) in each of the following recurrence. Make your bounds as tight as possible. (a) T ( n ) = 9 T ( n/ 2) + n 3 (b) T ( n ) = 7 T ( n/ 2) + n 3 (c) T ( n ) = T ( n ) + log n (d) T ( n ) = 0 . 5 T ( n/ 2) + n (e) T ( n ) = 3 T ( n/ 3) + n/ 3 2. (15%) Using the definitions of O -notation and ω -notation, show that: if f ( n ) ω ( g ( n )) , then f ( n ) / O ( g ( n )) . 3. (15%) Given an input list of n numbers, recall that Mergesort first divides the list into two parts, then sorts each part recursively, and finally merges the two sorted parts together. The running time of Mergesort is Θ( n log n ). Now suppose that we divide the input list into three parts, sort each part recursively, and finally merge the three sorted parts together (how?). Will this new algorithm run faster or slower in the asymptotic sense? Why? 4. Consider the following code segment: for (i = 1; i <= n; i++) { for (j = 1; j <= n; j += i) x = x + 1; } (15%) Analyze the running time of the code in terms of n . (Use Θ-notation.) 5. Let A be a sequence of numbers. Define

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.

{[ snackBarMessage ]}