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
Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
nika2105 [10]

Kernal is the core of an operating system that maintains the computer’s clock, starts applications, and assigns the computer’s resources, such as devices, programs, apps, data, and information.

d. kernal.

<u>Explanation:</u>

Every operating system runs the operating system based on kernel instructions. Main or major role of operating system is kernel. If boot loader program fails to load kernel operation is missing the kernel we need to reinstall operating system or repair the operating system.

To display clock in the workstation or laptop or desktop, clock device driver been executed by kernel of operating system.

Kernel is core of any operating system, but kernel also controlled by operating system such as Unix etc.

3 0
3 years ago
Heather writes an essay for language arts and receives a poor grade. To figure out why she gets a poor grade, Heather looks at t
Kazeer [188]

Answer:

Glows and grows strat

Explanation:

4 0
2 years ago
Read 2 more answers
Which of the following is a social news-sharing service?
Vsevolod [243]

Answer:

Reddit

Explanation:

Just google reddit and click the website and you can basically find everything there.

7 0
3 years ago
Read 2 more answers
4. The Internet may best be compared to a/an A. series of colored lights. B. loud truck motor. C. enormous skyscraper. D. large
Triss [41]
D. Large network of roads.

A resembles a modem/router and C a webserver.
6 0
3 years ago
One common command-line network utility tool is “netstat,” which displays which protocol is being used. It can review particular
labwork [276]

An example of two potential uses of this command is in the area or aspect of:

  • The troubleshoot of networking problems.
  • In configuration

<h3>What protocol does the netstat command use?</h3>

It is known to use the Internet Protocol (TCP/IP) and it is one that is used without parameters, this command  is said to often show active TCP connections.

<h3>What is netstat used for?</h3>

The network statistics ( netstat ) command is known to be a kind of a networking tool that is often used for troubleshooting and configuration, and this is one that can be used as a tool for monitoring for connections over the network.

Hence,  it is used in incoming and outgoing connections, routing tables, port listening, and others. Therefore, An example of two potential uses of this command is in the area or aspect of:

  • The troubleshoot of networking problems.
  • In configuration

Learn more about troubleshoot from

brainly.com/question/9572941

#SPJ1

3 0
2 years ago
Other questions:
  • OSHA requires that employers pay for most required personal protective equipment (PPE), including: A. Hard hats B. Logging boots
    5·1 answer
  • Which is the quickest way to change the font color in multiple, randomly located cells in a worksheet
    8·2 answers
  • ou work as network administrator for an organization that has a Windows-based network. You want to use multiple security counter
    10·1 answer
  • In 125 words describe the steps to active listening.
    6·1 answer
  • In this website/app what are the points for?
    7·1 answer
  • Consider a movie database in which data is recorded about the movie industry. the data requirements are summarized as follows:
    15·1 answer
  • What is batch processing?
    12·1 answer
  • If you tap or click the increase font size button too many times and make the font size too big, you can tap or click the _____
    9·1 answer
  • Given that Apache and Internet Information Services (IIS) are the two most popular web application servers for Linux and Microso
    10·1 answer
  • Inserting and deleting text is a basic editing task in word processing.<br><br> True or false
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!