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
define the physical components of hardware for a computer system,including identifying internal hardware devices(e.g. processor,
kap26 [50]

Answer:

Explanation:

The necessary hardware components that a computer requires to run properly are the following.

Motherboard, this is the main circuit board that interconnects all of the components and allows them to interact with each other.

CPU, this is the brain of the computer where all calculations and processes are handled.

Video Card, this component handles all the visual data, rendering that the computer needs in order to get a proper image.

RAM, these components are the physical memory where temporary data is stored and used.

Hard Disk, this is the main storage drive where all your data will be saved including the operating system.

PSU, this is the power supply of the unit that distributes the correct amount of power to every other component in the system.

Sound Card, this component handles all the input and ouput audio signals for a computer.

7 0
3 years ago
True or false? Opinionated websites can still be credible. A. True B. False
kumpel [21]
False. the information should not be biased in order to be creditable
5 0
4 years ago
Read 2 more answers
Explain the role of ICT in banks​
vladimir1956 [14]

Answer: ICT help banks improve the efficiency and effectiveness of services offered to customers, and enhances business processes, managerial decision making, and workgroup collaborations, which strengthens their competitive positions in rapidly changing and emerging economies.

Explanation: please give branliest I only need one more to make ace

7 0
3 years ago
What does no technical solution problems mean answers?
Lena [83]
Solve the problems to make every thing work perfect
4 0
3 years ago
Injection attacks variants can occur whenever one program invokes the services of another program, service, or function and pass
velikii [3]

Answer:

True

Explanation:

In Computer science, It's true that injection attacks variants can occur whenever one program invokes the services of another program, service, or function and passes to it externally sourced, potentially untrusted information without sufficient inspection and validation of it.

5 0
3 years ago
Other questions:
  • Will Mark the brainliest
    14·1 answer
  • Chris needs to modify the default bullets that are used in a nonnumbered list in word. Which method should he use?
    9·2 answers
  • You have no control over who view your post
    10·1 answer
  • which quotation from the story of the fisherman in the Arabian nights' entertainments supports the theme that cleverness trumps
    15·1 answer
  • If object B inherits from object A, then which of the following statements is true?
    15·1 answer
  • Brad is joining a big website design firm. He is worried that he may not be able to adapt to the company culture. What can he do
    15·1 answer
  • 8.10 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's a
    12·1 answer
  • Which is a characteristic of multimedia systems?
    7·1 answer
  • Which of the following activities does an effective team do?
    15·2 answers
  • Writea SELECT statement that uses the ranking functions to rank products by the total quantity sold. Returnthese columns:The pro
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!