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
Answer:
yes! of course and sure! okay
Go to settings and hit privacy to change who can see your posts
Answer:
It depends on the situation
import "from random import randrange"
for printing random numbers between integers "random.randrange(num1, num2"
Syntax:
"random.randrange(start, stop, step)"
Parameter Values:
start - optional - an integer defining which position to start - default = 0
stop - required - an integer defining which position to end.
step - optional - an integer define the incrementation - default = 1
Explanation:
The syntax is a bit weird but I hope I was a help
True
You can only do it ascending because you will get confused