HW2 - CSE 830 Homework#2 Due Sept 29th 2011 10:20am 1 Use the partitioning step of quicksort to give an algorithm that finds the median element of

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 830: Homework #2 Due Sept. 29 th 2011, 10:20am 1. Use the partitioning step of quicksort to give an algorithm that finds the median element of an unsorted array of n integers in expected O(n) time. 2. Outline an efficient method of solving each of the following problems. Give a tight bound on the worst-case complexity of your methods. You may describe your algorithm in a common programming language, in pseudocode, or in English, but please be sure to be thorough. a. Given an unsorted list of m stocks that you are investing in, and a sorted list of all n stocks available saying if their value has gone up or down today. Determine how many of your stocks have dropped. b. You are given a list of N packages that UPS delivered in a given month. For each package, you are given an unsorted list of the names of the M trucks it was transported on to reach its destination. Find the number of packages that were transported on each specific truck. (Note: this one can be a bit tricky if you consider that there may be many more packages than trucks.) c.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/11/2011 for the course CSE 830 taught by Professor Ofria during the Fall '08 term at Michigan State University.

Ask a homework question - tutors are online