{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# mid-prac - Fall 2011 Clyde Kruskal CMSC 351 Practice...

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

Fall 2011 Clyde Kruskal CMSC 351: Practice Questions for Midterm Exam These are practice problems for the upcoming midterm exam. You will be given a sheet of notes for the exam. Also, go over your homework assignments. Warning: This does not necessarily reflect the length, difficulty, or coverage of the actual exam. Problem 1. (a) What is the best-case number of moves in Insertion Sort? Justify. (b) What is the worst-case number of moves in Insertion Sort? Justify. (c) What is the average-case number of moves in Insertion Sort? Justify. Problem 2. (a) Is 2 n +1 = O (2 n )? (a) Is 2 2 n = O (2 n )? Problem 3. Use the iteration method to solve the following recurrences. You may assume n is “nice”. Prove you answers using mathematical induction. (a) T ( n ) = 2 T ( n/ 2) + n 3 , T (1) = 1. (b) T ( n ) = T ( n ) + 1, T (2) = 1. (c) T ( n ) = 2 T ( n/ 2) + n lg n , T (1) = 1. (d) T ( n ) = T ( n - 3) + 5, T (1) = 2. Problem 4. Which of the above problems can be solved using the “Master Theorem” derived in class. Solve them exactly using the “Master Theorem”. Problem 5. Assume you have an array of numbers, where each value occurs

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 ]}