Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given a list AA positive integers a1,,ana1,,an, and a positive integer BB. A subset S{1,2,,n}S{1,2,,n} is called feasible if its weight doen't exceed

image text in transcribed

You are given a list AA positive integers a1,,ana1,,an, and a positive integer BB. A subset S{1,2,,n}S{1,2,,n} is called feasible if its weight doen't exceed BB, i.e., if

iSaiB.iSaiB.

Your goal is to find a feasible subset S{1,2,,n}S{1,2,,n} such that

iSaiM/2,iSaiM/2,

where MM is the maximum weight achievable by any feasible subset.

Give an algorithm to solve this problem in time O(n)O(n).

Q4 (10 points) You are given a list A positive integers a1, ..., An, and a positive integer B. A subset S C{1,2,...,n} is called feasible if its weight doen't exceed B, i.e., if M/2, ies where M is the maximum weight achievable by any feasible subset. Give an algorithm to solve this problem in time O(n). Q4 (10 points) You are given a list A positive integers a1, ..., An, and a positive integer B. A subset S C{1,2,...,n} is called feasible if its weight doen't exceed B, i.e., if M/2, ies where M is the maximum weight achievable by any feasible subset. Give an algorithm to solve this problem in time O(n)

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

Financial Statements Analysis Cases From Corporate India

Authors: Sandeep Goel

1st Edition

1138663921, 9781138663923

More Books

Students also viewed these Accounting questions