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
Readme [11.4K]
3 years ago
11

A computing company is running a set of processes every day. Each process has its own start time and finish time, during which i

t runs continuously. The company has developed a process_check module, that runs briefly (consider this to take just 1 point in time) and records important pieces of information about the processes running at that time. The company would like to run the process_check module as few times as possible each day, while making sure that the module is called at least once during the execution of each process.
Required:

Give an efficient algorithm that based on the start and finish time of each process will find the smallest set of possible moments of time at which to run the process_check module (making sure that the module is invoked at least once for each process).
Computers and Technology
1 answer:
Helga [31]3 years ago
5 0

Answer:

Above all else, let us show that this issue has the greedy choice property.

This implies that worldwide ideal arrangement can be gotten by choosing local ideal arrangements. Presently notice the following:

The global optimal solution of the issue requests us to track down the minimum number of times process_check module should be run.

It is likewise referenced that during each running interaction, process_check module should be called atleast once. Along these lines, the minimum possible number of process_check calls happens when process_check is made close to the quantity of the processes that are run.

Along these lines, we see that the global optimal solution is shaped by choosing optimal answer for the nearby advances.

Along these lines, the issue shows greedy choice property. Thus, we can utilize a greedy algorithm for this issue.

The greedy step in this calculation is to postpone the process_check as far as might be feasible. Thus, it should be run towards the finish of each interaction. So the following algorithm can be utilized:

Sort the cycles by utilizing the completion times.

Towards the finish of the 1st process in the arranged list, run the process_check module. Right now any process that is now running is removed the arranged rundown. The main interaction is additionally removed from the sorted list.

Now repeat stage 2, till all processes are finished.

In the above mentioned algorithm, the costliest advance is the step of sorting. By utilizing the optimal sorting algorithm, for example, merge sort, we can achieve it in O(n log n) asymptotic time.

Along these lines, this greedy algorithm additionally takes O(n log n) asymptotic time complexity.

You might be interested in
Create a method called nicknames that passes an array as a parameter. Inside the method initialize it to hold 5 names of your ch
Gre4nikov [31]
<h2>Answer:</h2>

    //======METHOD DECLARATION=========//          

    //method name: nicknames                                          

    //method return type: void                                            

    //method parameter: an array reference                    

    public static void nicknames(String [] names){      

       //initialize the array with 5 random names              

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       //using an enhanced for loop, print out the elements in the array

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

<h2>Explanation:</h2>

The program is written in Java. It contains comments explaining important parts of the code. Kindly go through these comments.

A few things to note.

i. Since the method does not return any value, its return type is <em>void</em>

ii. The method is made public so that it can be accessible anywhere in and out of the class the uses it.

iii. The method is made static since it will most probably be called in the static main method (at least for testing in this case)

iv. The method receives an array of type <em>String </em>as parameter since the names to be stored are of type <em>String</em>.

v. The format of initializing an array manually should follow as shown on line 7. The <em>new</em> keyword followed by the array type (String), followed by the square brackets ([]) are all important.

vi. An enhanced for loop (lines 9 - 11) is a shorthand way of writing a for loop. The format is as follows;

=> The keyword <em>for</em>

=> followed by an opening parenthesis

=> followed by the type of each of the elements in the array. Type String in this case.

=> followed by a variable name. This holds an element per cycle of the loop.

=> followed by a column

=> followed by the array

=> followed by the closing parenthesis.

=> followed by a pair of curly parentheses serving as a block containing the  code to be executed in every cycle of the loop. In this case, the array elements, each held in turn by variable n, will be printed followed by a space.

A complete code and sample output for testing purposes are shown as follows:

==================================================

public class Tester{

    //The main method

    public static void main(String []args){

       

       String [] names = new String[5];

       nicknames(names);

    }

   

  //The nicknames method

    public static void nicknames(String [] names){

       names = new String[] {"John", "Doe", "Brian", "Loveth", "Chris"};

       for(String n: names){

           System.out.print(n + " ");

       }

       

    }

}

==================================================

<h2>Output:</h2>

John Doe Brian Loveth Chris

<em>NB: To run this program, copy the complete code, paste in an IDE or editor and save as Tester.java</em>

6 0
3 years ago
The oldest "computer" is thought to be how old? please help i beggiging 20 points
igomit [66]
The oldest “computer” is2,000 years old.

5 0
3 years ago
Read 2 more answers
____________ is the ability to stand up for your own interests and to ask for what you want. A. Discipline B. Arrogance C. Asser
devlian [24]
C. Assertiveness. Assertiveness is defined as confident and forceful behavior, so it is the only one that makes sense.
8 0
3 years ago
Read 2 more answers
Sarah is delivering a presentation on the solar system. Each slide consists of not more than four to five points. However, she n
slava [35]

Answer:

Handouts

Explanation:

Handouts is the section where the audience can have a more detailed grasp on the points presented in the slide for more in dept information about the presentation.

5 0
3 years ago
In your own words, explain what it means to “buy low, sell high.”
Georgia [21]

Answer:

Resell value should be high like buying a used car for a low price fixing it a bit and double your money.

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • You're familiar with the story of Hansel and Gretel, so when you decide to go exploring you always make sure to keep track of wh
    14·1 answer
  • Suppose two hosts, A and B, are connected by a 10 Mbps link. The length of a packet is 12 Kb (Kilobits, i.e., 12 × 103 bits). Th
    15·1 answer
  • The _____ of each phrase in a melody can be drawn with a curved line that follows the direction of the note progression.
    15·1 answer
  • The term "stop" is used to refer to a change in aperture. If I change my f stop setting from f/8 to f/11, it's one-stop up which
    9·1 answer
  • Explain how the operating system controls the software and hardware on the computer?
    5·1 answer
  • Write a C console application that will be used to determine if rectangular packages can fit inside one of a set of spheres. You
    5·1 answer
  • Which situation is the best choice for using telehealth?
    12·1 answer
  • Explain the uses of computer in police department​
    13·2 answers
  • What is a wiki website?
    11·1 answer
  • What are the different types of topology?​ in details
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!