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
forsale [732]
3 years ago
10

The SPF strategy can be proven to be optimal in the sense that it minimizes average response times. In this problem, you will de

monstrate this result empirically by examining all possible orderings for a given set of five processes. Suppose five different processes are waiting to be processed, and that they require 1, 2, 3, 4 and 5 time units, respectively. Write a program that produces all possible permutations of the five processes (5! = 120) and calculates the average waiting time for each permutation. Sort these into lowest to highest average waiting time order and display each average time side by side with the permutation of the processes. Comment on the results.

Computers and Technology
1 answer:
Anna35 [415]3 years ago
6 0

Answer:

Program;

#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

int main() {

vector<int> order = {1, 2, 3, 4, 5}; // initial job order

vector<pair<float, vector<int> > > data; // each pair is {average waiting time, jobs order}

int c = 0;

do {

// calculate average waiting time for the order

float avg_wait = 0;

for(int i = 0; i < order.size() - 1; ++i) {

avg_wait += order[i];

}

avg_wait /= 5;

data.push_back(make_pair(avg_wait, order));

} while(next_permutation(order.begin(), order.end()));

// sort according to average wait time

sort(data.begin(), data.end());

// display the result

cout << "avg_wait_time\tpermutation\n\n";

for(int i = 0; i < 120; ++i) {

cout << data[i].first << "\t\t";

for(int j = 0; j < 5; ++j) {

cout << data[i].second[j] << " ";

}

cout << endl;

}

Explanation:

See attachment for code screenshot

You might be interested in
In what way is your social media footprint related to your digital ID
ANEK [815]
Your social media footprint is literally your digital ID. Your digital ID is what you are online and your footprint is what you do.
3 0
4 years ago
Imagine a situation where two developers are simultaneously modifying three different software components. what difficulties mig
lbvjy [14]
A main problem that may arise is if they have created two different ways of adressing the same part of the software
4 0
3 years ago
Horizontal lines should be avoided in photographs because they make the photograph appear small.
Dovator [93]
False. horizontal can be used for landscape pictures to create a depth effect
4 0
4 years ago
Even though the Pizza Hut corporation understood the need to make use of the Web, the franchise owners were skeptical. From an I
Gelneren [198K]

Answer:

Franchise owners are essential stakeholder group whose opinions are directly related to the company's success.

Explanation:

Franchise owners are essential stakeholder groups. A stakeholder is a person, organization, social group. A stakeholder can be internal or external to the business. Stakeholders affected by business and affect the business.

Different type of stakeholder is

  • Customer
  • Employees
  • Investors
  • Suppliers
  • Owners

Pizza Hut corporation owner is a stakeholder whose opinions are related to the company's success.

8 0
4 years ago
Suppose that you want to write a program that inputs customer data including name, zipCode, balance, and regionNum. At the end o
Sergio039 [100]

The most likely statement during the main processing loop would be

customerCount[regionNum] =

customerCount[regionNum] + 1

<h3>What is a processing loop?</h3>

A loop means a sequence of instruction s that is continually repeated until a certain condition is reached.

In this case, the most likely statement during the main processing loop would be customerCount[regionNum] = and customerCount[regionNum] + 1.

Learn more about loop on:

brainly.com/question/4510147

#SPJ12

4 0
2 years ago
Other questions:
  • The process of bringing data or a file from one program to another is called
    13·2 answers
  • The program has a compilation error because s is not initialized, but it is referenced in the println statement. The program has
    8·1 answer
  • What are three reasons teens might start drinking alcohol??
    7·2 answers
  • Plot absorbance versus concentration in μmol/L of the Tartrazine solution at the wavelength of the maximum absorbance of Allura
    10·1 answer
  • David Doe is a network administrator for the ABC Company. David is passed over for promotion three times. He is quite vocal in h
    14·1 answer
  • Marissa, a 21-year-old young woman, is working as an intern at a software company. She has recently graduated from college. She
    6·1 answer
  • When you use information hiding by selecting which properties and methods of a class to make public, you are assured that your d
    14·1 answer
  • What precautions should be taken to make a computer more secure ​
    8·1 answer
  • Can you plz type down a word.
    11·2 answers
  • (10 LC)
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!