CSci 3501 Algorithms and Computability  Lab 5.
September 30. Due Monday, October 6 at 11:59pm
What to submit and when:
 All submissions are electronic: by email to elenam at morris.umn.edu and CC to all lab partners. Please do not delete your email from "Sent mail" or your mailbox until the end of the semester.
 When working on the lab, please comment your work so that it is clear what contributions of each person are.
 At the end of the lab each group should send me the results of their
inclass work. Please indicate if this is your final submission.
 If your submission at the end of the lab time was not final, please send me(CC to the lab partner(s)) a final copy before the due time. Please use the subject "3501 Lab N", where N is the lab number.
Lab assignment
Work in pairs
Lab overview and goals
The goal of the lab is to continue a study of approximation and optimal algorithms. Your goal is to solve two cases of a ``shopping cart'' problem:
Suppose you won a grocery shopping spree to fill your cart with items of varying values and sizes. The object is to place the largest value of these items as possible into your cart which has a capacity bound, B. For example, consider B = 40 and the following list of items:
Item

Value ($)

Size (units)

A

60

10

B

100

20

C

120

30

Which items would you choose?
You need to solve two cases of this problem:

Design and implement an efficient algorithm for choosing from n random items of varying sizes and values that fit within the capacity bound B as to maximize value. Items may not be duplicated, other than duplicates within the existing random data set.

Design and implement an efficient algorithm for choosing fractional parts of n random items of varying sizes and values that fit within the capacity bound B as to maximize value. Objects in the list may be broken into components of any size before being added to the cart.
Please answer the following questions:
 What is the BigO efficiency of your algorithms in part 1 and part 2, given n items?
 Does your algorithm for Part 1 find the optimal solution? If yes, please explain why. If not, please give an example when it does not, show the optimal item combination.
 Does your algorithm for Part 2 find the optimal solution? If yes, please explain why. If not, please give an example when it does not, show the optimal item combination.
Programming requirements and what to submit
 Your program, appropriately documented. Your program may read data in any convenient format (from the Java console or from a file). The comments in teh program should clearly explain how it reads the data (examples help). If you are reading data from a file, please include the test files, otherwise just copy/paste the test data into a separate file or into comments at the end of the program.
 The test data and the results.
 A clear explanation of your algorithms in English.
 Answers to the three questions above, with explanations.
CSci 3501
course web site.
The views and opinions expressed in this page are strictly those of the page author. The contents of this page have not been reviewed or approved by the University of Minnesota.