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
List four examples of soft and hard skills
emmainna [20.7K]

Answer:

Explanation:

soft skills

1 – Communication. ...

2 – Teamwork. ...

3 – Adaptability. ...

4 – Problem-Solving. ...

hard skills

Technical Skills

Computer Skills

Analytical Skills

Marketing Skills

8 0
3 years ago
Read 2 more answers
Complete the following sentences by choosing the best answer from the drop-down menus.
aleksandrvk [35]

Answer:

b. Application software

Explanation:

Applications are type of software that are installed in a specific operating system of a computer that deviates from those system software installed together with the system itself. These third-party applications are necessary for other functions such as entertainment, business, leisure and other needs addressing of which the system software can't provide.

Examples:

Microsoft Office Word, Excel, Powerpoint

i think i did that right:)

7 0
3 years ago
How to get to command prompt screen if i forgot password?
Sidana [21]
Commands into software documents tools
3 0
3 years ago
Interactive sites where users write about personal topics and comment to a threaded discussion are called?
larisa [96]

Answer:

C. forums

Explanation:

Forums are internet sites where users can meet to discuss different topics through the use of messages thereby forming chat rooms. An internet forum can be in form of a question and answer site. Most websites have internet forums where users can meet and discuss or ask questions. Sometimes there may be moderators that ensure that the posted messages are acceptable based on guidelines.

4 0
4 years ago
Questions: 1) Sequential pattern mining is a topic of data mining concerned with finding statistically relevant patterns between
trapecia [35]

Answer and Explanation:

The sequential data or sequence data is described as data that come in an ordered sequence. It may also be termed data that is produced from tasks that occurs in sequential order The sequential pattern mining is a critical subject in data mining that has do with applying sequential data to derive a statistically relevant pattern from it.

Sequential pattern mining is a part of data mining. Data mining involves utilizing data from databases to understand and make decisions that better the organization or society as a whole based on this. Common data mining tasks include: clustering, classification, outlier analysis, and pattern mining.

Pattern mining is a kind of data mining task that involves explaining data through finding useful patterns from data in databases. Sequential pattern mining is pattern mining that uses sequential data as a source of data in finding data patterns. Sequential pattern mining applies various criteria(which maybe subjective) in finding "subsequence" in data. Criteria could be :frequency, length, size, time gaps, profit etc. Sequential pattern mining is commonly applicable in reality since a sizeable amount of data mostly occur in this form. A popular type of sequential data is the time series data.

6 0
3 years ago
Other questions:
  • Data mining is ______? a process of finding meaningful patterns in data to improve decisions a strategy for locating security so
    7·1 answer
  • Who wants sum points? spam this and ill put 3 questions up for 100 points i have 7111 points rn
    7·2 answers
  • Which option best describes the cheapest way to file your federal income taxes?
    5·1 answer
  • i see tabs named mowed and Ramsey i tried shredding them and deleting them and ending all the processes but they start duplicati
    13·1 answer
  • _______ allow(s) you to apply colorful, eye catching designs to a presentation all at once.
    8·2 answers
  • In paragraph form, explain and describe at least three common situations in which you would yield the right-of-way.
    5·1 answer
  • Difrent between computer and computer system​
    9·1 answer
  • Any please answer this How much resistance is required to gen-erate 50 mA of current from a 5 volt bat-tery?
    5·1 answer
  • Kelly wants to change the text in a cell so that it is centered instead of left-aligned, where should she look to make this
    8·1 answer
  • The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a select
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!