1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
guapka [62]
3 years ago
10

1- Design a brute-force algorithm for solving the problem below (provide pseudocode): You have a large container with storage si

ze: W lb. You have many Items (n) where each item weight is: wi. the algorithm you design should find the subset of items with the largest weight not exceeding W (Container storage capacity)
2- Submit a simple program in Java that implements your algorithm with an example test run.
Computers and Technology
1 answer:
sladkih [1.3K]3 years ago
3 0

Answer:

Pseudocode is as follows:

// below is a function that takes two parameters:1. An array of items 2. An integer for weight W

// it returns an array of selected items which satisfy the given condition of sum <= max sum.

function findSubset( array items[], integer W)

{

initialize:

maxSum = 0;

ansArray = [];

// take each "item" from array to create all possible combinations of arrays by comparing with "W" and // "maxSum"

start the loop:

// include item in the ansArray[]

ansArray.push(item);

// remove the item from the items[]

items.pop(item);

ansArray.push(item1);

start the while loop(sum(ansArray[]) <= W):

// exclude the element already included and start including till

if (sum(ansArray[]) > maxSum)

// if true then include item in ansArray[]

ansArray.push(item);

// update the maxSum

maxSum = sum(ansArray[items]);

else

// move to next element

continue;

end the loop;

// again make the item[] same by pushing the popped element

items.push(item);

end the loop;

return the ansArray[]

}

Explanation:

You can find example to implement the algorithm.

You might be interested in
2.<br> The force of impact is
NNADVOKAT [17]

Answer:

lực ( Tiếng Anh : force ) là bất kỳ ảnh hưởng nào làm một vật thể chịu sự thay đổi, hoặc là ảnh hưởng đến chuyển động, hướng của nó hay cấu trúc hình học của nó.

Explanation:

7 0
3 years ago
1. Data in a smart card can be erased
Ostrovityanka [42]

Answer:

false

true

false

true

true

5 0
3 years ago
Read 2 more answers
Help me find the right answer please.
timama [110]

Answer:

I'm not sure

Explanation:

I'm good at math but I do not see any numbers to work with. SORRY

5 0
2 years ago
Cell address A4 in a formula means it is a _________Mixed cell reference​
wel

Answer:

Relative cell reference.

Explanation:

Microsoft Excel is a software application or program designed and developed by Microsoft Inc., for analyzing and visualizing spreadsheet documents.

A spreadsheet can be defined as a file or document which comprises of cells in a tabulated format (rows and columns) typically used for formatting, arranging, analyzing, storing, calculating and sorting data on computer systems.

A relative cell reference can be defined as a cell whose reference is mainly relative to the location of the cell.

In Microsoft Excel, the cell reference is considered to be a relative reference by default.

Hence, the cell address A4 in a formula means it is a relative cell reference and when the formula is copied, the reference in the formula will change.

For example, if you refer to cell A4 from cell D4, it means you're pointing to the cell that is three (3) columns to the left of the same row i.e D minus A (D - 4).

6 0
2 years ago
Please answer fast as soon as possible.
zhenek [66]

Answer:

1. Scripts area is the main working area in Scratch.

2. Sensing blocks are color-coded light blue.

3. Adware is a malware which pops up a window, informing the user that the system is infected and asks for a fee to clean it.

4. Amaya is a WYSIWYG.

8 0
2 years ago
Other questions:
  • Using the _____ model brings sellers and buyers together on the web and collects commissions on transactions between these parti
    5·1 answer
  • What would you recommend for data segregation if using cloud software
    12·2 answers
  • You have a chart that shows 100 data points and you've circled the highest value. Which of the following are you using?
    8·1 answer
  • Match the job description to the level of degree it requires.
    15·1 answer
  • What code do I have to use in my php if i don’t want my $_SESSION[“variablex”] to destroy? But i already have a session_destroy(
    6·1 answer
  • Edhesive 7.6 lesson practice python
    11·1 answer
  • Create a Python program that computes the cost of carpeting a room. Your program should prompt the user for the width and length
    10·1 answer
  • Select the correct text in the passage.
    12·1 answer
  • Name various input and output devices used with computers.
    7·1 answer
  • Which extra step do verizon devices require for fenrir to be allowed to connect to the device?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!