Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C program for the following problem. There are n items in the suitcase of a traveler. On boarding the flight, the airline company

image text in transcribed
Write a C program for the following problem. There are n items in the suitcase of a traveler. On boarding the flight, the airline company told him that his suitcase is over weight than the allowed capacity W and asked him to deload some items and not to carry more than W. He knows weight of each item. Devise an algorithm to find out which items to be discarded so that he can carry max. weight W. (assume the weight of the suitcase is ignored). Note: The objective here is that he must carry maximum items. For example Weights of items: 53 21 W=6 Output: 0111 Weights of items : 20 12 10 7 5 W=27 Output: 00111 Note: Read number of items, knapsack capacity and weights of items from the user. Print the solution. For example: Input Result 0 1 1 1 4 6 5 3 2 1 00111 5 27 20 12 10 7 5

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

LO5 Describe job analysis and the stages in the process.

Answered: 1 week ago