
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: Unknown 1989;
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Summer 2008 CMSC 351: Homework 8 Clyde Kruskal
Due at the start of class Wednesday, July 9, 2008.
Problem 1.
(a) Illustrate the operation of radix sort on the following list of English words: RUTS, TOPS, SUNS, SPOT, TONS, OPTS, TORS, ROTS, ROOT, OUTS, SUPS, PUTT (b) Write an English sentence using both “tor” and “rot” (that indicates you under- stand the meanings of both words).
Problem 2. In class, we solved the selection problem by breaking the list into groups of 5 elements each.
(a) We used the fact that you can find the median of 5 numbers with 10 comparisons (by sorting). It turns out that you can find the median with only 6 comparisons. (i) Write down the recurrence for the running time using this new fact. (You can ignore floors and ceilings, as we did in class.) (ii) Solve the recurrence. (b) (i) How may comparisons do you need to find the median of 3 elements? Justify you answer. (ii) Write down the recurrence for a selection algorithm based on columns with three elements each. (You can ignore floors and ceilings, as we did in class.) (iii) Solve the recurrence. (c) You need to 10 comparisons to find the median of 7 elements? (i) Write down the recurrence for a selection algorithm based on columns with 7 elements each. (You can ignore floors and ceilings, as we did in class.) (ii) Solve the recurrence. (d) What did you learn?
Problem 3. Do Exercise 9.3-9 on page 193 of CLRS
Problem 4. Challenge problem. Show how to find the median of 5 numbers with only 6 comparisons.