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
Is jesus dead or alive
Morgarella [4.7K]

Answer:

Explanation:

i think he alive but in heaven i dunno

8 0
3 years ago
Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
andreyandreev [35.5K]

Answer:If you need to use arrows in a chart, which feature or menu option of a word processing program would you use?

A.  

Picture

B.  

Shapes

C.  

Clip Art

D.  

SmartArt

E.  

Charts

Explanation:

7 0
3 years ago
Everybody at a company is assigned a unique 9 digit ID. How many unique IDs exist?
Brut [27]
If you include all zeroes, then it should be 1,000,000,000. Otherwise it’s 999,999,999.

Think of how between 0-9 theres 10 numbers, and use that logic towards 000000000-999999999
3 0
3 years ago
The material to be broadcast and the way it's arranged is called __________. (10 letters)
ladessa [460]

Answer:

journalism

Explanation:

7 0
3 years ago
Distinguish between the desktop publishing packages and multimedia packages​
maksim [4K]

Answer:

___________________________________________________________

Word processing software is used for working with text, while desktop publishing software involves production of documents that combine text with graphics. DTP software is perfect for making flyers, brochures, booklets. This type of software is usually more advanced than word processing apps.

___________________________________________________________

4 0
2 years ago
Other questions:
  • c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m
    14·1 answer
  • Pls Help Me!!!!!!!!!!! It won’t work when I connect to ITunes!
    12·1 answer
  • Which is a good guideline to follow when choosing a background for your slides?. . A. Use a different background for each slide.
    8·1 answer
  • What does snap do need the answer now
    10·2 answers
  • When parking uphill on a street with no curb, how should your front wheels be positioned? A. Turned to the left (toward the stre
    14·2 answers
  • Ok so I usually don’t do this but I just need an answer , on Instagram a notification popped up while I was watching someone’s s
    9·2 answers
  • We need an equals method for the Dog class. It needs to give back to the caller a boolean value indicating whether another objec
    5·1 answer
  • What is HTML? (list down any 5 points)
    12·1 answer
  • I need help thanks please!
    8·2 answers
  • _____________are where you get down to business and enter data in a worksheet
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!