fin-prac - Fall 2011 Clyde Kruskal CMSC 351: Practice...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 2

fin-prac - Fall 2011 Clyde Kruskal CMSC 351: Practice...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online