
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Assignment; Professor: Kruskal; Class: Algorithms; Subject: Computer Science; University: University of Maryland; Term: Summer I 2009;
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Summer 2009 CMSC 351: Homework 7 Clyde Kruskal
Due at the start of class, Wednesday, July 1.
Problem 1. Assume you have a list of n elements where the first n/k elements are the smallest (but not sorted), the next group of n/k elements are the next smallest (but not sorted), ..., and the last n/k elements are the largest (but not sorted). You may assume k divides n.
(a) Give an algorithm that sorts this list with as few comparisons as possible (as a function of n and k). Just get the high order term right. How many comparisons does your algorithm use? (b) Show that your algorithm is optimal using a decision tree argument on the entire list. (I.e., do not argue that you must solve k independent sorting problems.)
Problem 2. Do Exercise 8.2-4 on page 170 of CLRS.
Problem 3.
(a) Illustrate the operation of radix sort on the following list of English words: RUTS, TOPS, SUNS, SPOT, TONS, OPTS, TORS, SOTS, ROOT, OUTS, SUPS, PUTT (b) Write an English sentence using both “tor” and “sot” (that indicates you under- stand the meanings of both words).