Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 4: Shopping Spree: (15 points) Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Problem 4: Shopping Spree: (15 points) Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example, one family member can take one television, one watch and one toaster, while another family member can take one television, one camera and one pair of shoes. Each item has a price in dollars) and a weight (in pounds) and each person in the family has a limit in the total weight they can carry. Two people cannot work together to carry an item. Your job is to help the families select items for each person to carry to maximize the total price of all items the family takes. Write an algorithm to determine the maximum total price of items for each family and the items that each family member should select. Submit to Canvas CS 325 - Homework Assignment 3 a) A verbal description and give pseudo-code for your algorithm. Try to create an algorithm that is efficient in both time and storage requirements. b) What is the theoretical running time of your algorithm for one test case given N items, a family of size F, and family members who can carry at most M pounds for 1 Sis F. c) Implement your algorithm by writing a program named "shopping" (in C, C++ or Python) that compiles and runs on the OSU engineering servers. The program should satisfy the specifications below. Input: The input file named "shopping.txt" consists of T test cases T (1 ST 100) is given on the first line of the input file Each test case begins with a line containing a single integer number N that indicates the numben of items (1 SNS 100) in that test case Followed by N lines, each containing two integers: P and W. The first integer (1 s P S 5000) corresponds to the price of object and the second integer (1 SW S 100) corresponds to the weight of object. The next line contains one integer (1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions