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
olga_2 [115]
4 years ago
11

C++ Problem: In the bin packing problem, items of different weights (or sizes) must be packed into a finite number of bins each

with the capacity C in a way that minimizes the number of bins used. The decision version of the bin packing problem (deciding if objects will fit into <= k bins) is NPcomplete. There is no known polynomial time algorithm to solve the optimization version of the bin packing problem. In this homework you will be examining three greedy approximation algorithms to solve the bin packing problem.
- First-Fit: Put each item as you come to it into the first (earliest opened) bin into which it fits. If there is no available bin then open a new bin.

- First-Fit-Decreasing: First sort the items in decreasing order by size, then use First-Fit on the resulting list.

- Best Fit: Place the items in the order in which they arrive. Place the next item into the bin which will leave the least room left over after the item is placed in the bin. If it does not fit in any bin, start a new bin.

Implement the algorithms in C++. Your program named bins.cpp should read in a text file named bin.txt with multiple test cases as explained below and output to the terminal the number of bins each algorithm calculated for each test case. Example bin.txt: The first line is the number of test cases, followed by the capacity of bins for that test case, the number of items and then the weight of each item. You can assume that the weight of an item does not exceed the capacity of a bin for that problem.

3

10

6

5 10 2 5 4 4

10

20

4 4 4 4 4 4 4 4 4 4 6 6 6 6 6 6 6 6 6 6

10

4

3 8 2 7

Sample output: Test Case 1 First Fit: 4, First Fit Decreasing: 3, Best Fit: 4

Test Case 2 First Fit: 15, First Fit Decreasing: 10, Best Fit: 15

Test Case 3 First Fit: 3, First Fit Decreasing: 2, Best Fit: 2
Computers and Technology
1 answer:
ipn [44]4 years ago
4 0

xekksksksksgBcjqixjdaj

You might be interested in
Discuss how a lack of infrastructure in poor communities could contribute to ill-health such as the Unrest looting.​
shutvik [7]

Answer:No service from hospital for injured people

Explanation:

Yes of course

4 0
3 years ago
Whats in a computer?
kenny6666 [7]
A lot of things are in a computer there a motherboard, A cpu, A hard drive etc. A motherboard is the computer system  bascilly its the heart for a computer. The cpu is the the brain of a computer it controls on your computer and keeps it going good. finally a hard rive is the memory of your computer it stores all the data including files, photos, etc
8 0
3 years ago
Read 2 more answers
Luminaires for fixed lighting installed in Class II, Division 2 locations shall be protected from physical damage by a suitable
ser-zykov [4K]

Given what we know, the protection for fixed lightings like the ones described in the question is by way of a guard or by location.

<h3>Why is protection necessary?</h3>

Luminaires, as with all lighting solutions, can be dangerous if proper safety precautions are not taken. The precautions, in this case, include a safe installation location or the use of a guard to prevent damage to the lighting and subsequently to any nearby occupants of the location.

Therefore, we can confirm that Luminaires for fixed lighting installed in Class II, Division 2 locations shall be protected from physical damage by a suitable guard or by a safe location.

To learn more about Electrical safety visit:

brainly.com/question/14144270?referrer=searchResults

4 0
3 years ago
Marissa bought 2 and 1/2 gallons of orange juice to make punch how many quarts of orange juice did Marissa Buy
Vladimir [108]
1 gallon = 4 quarts
using this information, you can then use simple proportion.
if 1 gallon = 4 quarts 
then to find the amount of quarts in 2 and 1/2 gallons, you multiply 2 and 1/2 by 4 which should give you 10 gallons
5 0
3 years ago
Read 2 more answers
Why are most minicomputers no longer used​
Svet_ta [14]

Answer:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Explanation:

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as small or midsize servers.

Minicomputers are used for scientific and engineering computations, business-transaction processing, file handling, and database management, and are often now referred to as sma

7 0
4 years ago
Other questions:
  • In tableData the column variable of the first column should be RowerNames, the second RowingEvent, the third RowerWeight and the
    6·1 answer
  • REEEEEEE I STILL NEED MORE AESTHETIC USERNAMES TO GO OFF OF PWEASE HELP IMA HAVE A PANIC ATTACK!!!... next post ima do a vote :&
    13·1 answer
  • If a cheetah covers 155 meters in 5 seconds, at what speed is the cheetah running?
    14·2 answers
  • Two of the goals of community mobilization are getting the community interested and
    6·1 answer
  • Help fast pls will mark brainliest - What model is best to use for large complex accounting software that can be broken down int
    6·1 answer
  • URGENT HELP PLEASE
    13·1 answer
  • Which of the following is NOT true about simple machines?
    10·1 answer
  • Danny wants to create a web page for her friends dog walking service. Which coding language should she use
    12·1 answer
  • Which line of code in this program is MOST likely to result in an error
    15·2 answers
  • Marcus traded in his 10-year-old truck for a new one. Because it is the first new truck he
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!