Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Homework #8 Problems - Algorithms | CMSC 351, Assignments of Algorithms and Programming

Material Type: Assignment; Professor: Kruskal; Class: Algorithms; Subject: Computer Science; University: University of Maryland; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-o74
koofers-user-o74 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Homework #8 Problems - Algorithms | CMSC 351 and more Assignments Algorithms and Programming in PDF only on Docsity! 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.
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved