Question: please send correct answer for thumbs up Write a C program for the following problem. There are n items in the suitcase of a traveler.
Write a C program for the following problem. There are n items in the suitcase of a traveler. a On boarding the flight, the airline company told him that his suitcase is over weight than the allowed capacity W and asked him deload some items and not to carry more than W. He knows weight of each item and knows the priority (like which item is the most, next most, etc.). Devise an algorithm to find out which items to be discarded based on priority (1-high priority, 2- next high priority and so on) so that he can carry max. weight W (assume the weight of the suitcase is ignored). For example, Weights : 10 7 8 4, Priority: 13 4 2 and W=16, the output is 1001 Weights : 4 7 2 3 Priority: 412 3 and W=10, the output is 0 110 Note : Read number of items, weights of items, priorities of items and knapsack capacity from the user. Print the solution. For example: Input Result 4 1001 4 10 7 84 1 3 4 2 16 0110 4 4 7 2 3 4 1 2 3 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
