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
rusak2 [61]
3 years ago
15

Write a function that, given an array A of N integers, of which represents loads caused by successive processes, the function sh

ould return the minimum absolute difference of server loads.
Computers and Technology
1 answer:
Papessa [141]3 years ago
6 0

Answer:

// here is code in c++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{ // variable to store number of loads

   int n;

   cout<<"enter the number of servers:";

   // read the number of servers

   cin>>n;

   // create an integer array of servers of size n

   int server_load[n];

   // read the load of each server

   cout<<"enter the loads on each server:"<<endl;

   for(int x=0;x<n;x++)

   {

       cin>>server_load[x];

   }

   // sort the array

   sort(server_load,server_load+n);

   int min_diff=MAX_INT;

   // find the minimum absolute difference between the server load

   for(int y=0;y<n-1;y++)

   {

       int d=server_load[y+1]- server_load[y];

       if(d<min_diff)

       min_diff=d;

       

   }

   // print the minimum difference

   cout<<"minimum absolute difference of server load is: "<<min_diff<<endl;

return 0;

}

Explanation:

Read the number of servers from user and assign it to "n".Create an integer Array of size n to store the load on each server.Read the load of each server and store  in the array. Sort the array. Then find the minimum difference between two load of servers. Print the minimum difference.

Output:

enter the number of servers:6                                                                                              

enter the loads on each server:                                                                                            

12 45 5 9 3 24                                                                                                            

minimum absolute difference of server load is: 2

You might be interested in
Which mark is an indicator of invalid data in a cell?
Snowcat [4.5K]

Answer:

A.) red circle around the value

Explanation:

Just did the Assignment on Edge 2021

Plz click the Thanks button!

<Jayla>

4 0
3 years ago
What happens to a message when it is deleted?
olya-2409 [2.1K]

Answer:

it goes to the deleted items area

Explanation:

but it also depends on where you deleted it on

5 0
2 years ago
Read 2 more answers
Mrs. Golden wanted to collect baseline data on how often Lauren speaks to her neighbors during silent reading. He divided the 15
Mila [183]

Answer:

Interval Recording

Explanation:

According to my research on different data collection methods, I can say that based on the information provided within the question this method of data collection is called Interval Recording. This refers to the process of collecting different pieces of data from different parts of the same interview or study. Which is what Mrs. Golden is doing.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
3 years ago
Select the most likely outcome of making only on-time minimum payments to a credit
Serjik [45]
The answer is B. Your will have gone mostly towards paying interest and you will still owe the majority of the balance that you had from ago
4 0
3 years ago
Bunco is a dice throwing game that requires no decisions to be made or skill on the part of the player just luck. In the simples
anygoal [31]
Abcdefghijklmnopqrstuvwxyz now I know my abcs, next time won’t you sing with me :)
8 0
1 year ago
Other questions:
  • George is a contractor who creates websites and web applications. What is George working as?
    7·2 answers
  • With network management software, a network manager can ____.
    6·1 answer
  • Which network media uses different regions of the electromagnetic spectrum to transmit signals through air?
    13·1 answer
  • What are the characteristics of good blogs?
    8·1 answer
  • Pleasee help. How do you fix this problem in discord?
    10·1 answer
  • A _____ can be used to create and test prototypes, develop interfaces, and simulate factory layouts and assembly lines, without
    10·1 answer
  • Please write a Java program to read movies.txt file. (It is in Modules under Chapter Code) Create your own movies.ser file from
    14·1 answer
  • Website designers work on the code and programming of a website, not the style or layout of the site.
    9·1 answer
  • Which of the following is a type of input device?
    5·1 answer
  • If you had tickets for the concert and saw these alerts, what should you do?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!