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
The part of the computer that contains the brain or the Central Park nursing unit is also known as
Mice21 [21]
The tower of the computer. <--- Answer

The big square thing lol.
4 0
3 years ago
In an array based implementationof a queue a possible solution to dealing with the full condition is to
kati45 [8]

Answer:

D. Maintain a count of queue items.

Explanation:

For checking the full condition of a queue you have to  check whether the number of elements in the array are equal to the size of the array.If they are equal then we can that the queue is full.

Checking frontindex equal to backindex is for checking if the queue is empty.

In option C we have to check for arrayFullException but it will not be a good approach.

So we conclude by saying that the answer is option D.

6 0
3 years ago
the front desk of the Nocete's Hotel will comlute the total room sales (TRS) of Room 101.The room was occupied three times and t
Rus_ich [418]

Answer:

Php. 1050

Explanation:

Total Room sales for Room 101:

Rate = 350

Number of times occupied = 3

Total sales per room : (number of times room was occupied * rate of the room.)

Hence, total sales for room 101:

Php. 350 * 3

= Php. 1050

4 0
3 years ago
Suggest three ways in which celebrating an occasion influences food choices?
Basile [38]

Celebrating influences food in more than 1 way
6 0
2 years ago
Read 2 more answers
To apply format to text, both the text and the text box must be selected.
Xelga [282]
I say it is true
hope this helps!
5 0
3 years ago
Other questions:
  • To go to a specific cell, press the function key
    9·1 answer
  • How many slides should a presentation include?
    11·2 answers
  • The graph of which function has an axis of symmetry at x=-1/4​
    15·1 answer
  • When discussing the data-modeling building blocks, anything (a person, a place, a thing, or an event) about which data are to be
    15·1 answer
  • Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integer
    7·1 answer
  • What type of diagram will you find nodes?
    15·1 answer
  • i have a class for computers and i need a free hardrive are there any websites that give me one for free in 3 days??​
    15·1 answer
  • You’re configuring a Web-based intranet application on the WebApp server, which is a domain member. Users authenticate to the We
    13·1 answer
  • Which is not one of the four criteria for proving the correctness of a logical pretest loop construct of the form: while B do S
    14·1 answer
  • Lesson 3 - Calling All Operators
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!