This preview shows pages 1–2. 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: Fall 2011 Clyde Kruskal CMSC 351: Practice Questions for Final Exam These are practice problems for the upcoming final exam, which we will go over in class on Monday. 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. Assume you are given a list of n values, where you know that every value is within k positions of its true sorted position. You can assume k is small. (a) Give a lower bound on the number of comparisons needed to sort the list as a function of k and n . (b) Give an efficient algorithm for sorting the list. Try to minimize the number of com- parisons. Analyze how many comparisons your algorithm uses as a function of k and n . (c) Compare your upper and lower bounds. Problem 2. Assume that you developed an algorithm to find the (index of the) n/ 3 smallest element of a list of n elements in 2 n comparisons....
View Full Document
- Fall '11