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
Grace [21]
3 years ago
9

Letm1, m2,···mnbe distinct numbers on the number line, in the increasing order. Your goalis to color all of them blue. You have

magical blue pens with the following property: Whenyou place the pen at co-ordinate x, all the points in the range [x - 5, x + 5] turn blue. Apen can be used only once. Give an algorithm to color all the points using as few pens aspossible. Prove the correctness of the algorithm and derive the runtime.
Computers and Technology
1 answer:
siniylev [52]3 years ago
7 0

Answer:

Following are the algorithm to this question:

y = 0 //  initialize variable y that assigns the value  0

p = 1 // initialize value 1 in the variable p which also known as starting position

init num = 1//define variable num that assign value 1

for j = 1 to n: //defining loop

y = m[j] - m[p]

if (y > 10) //defining if block

num++;  //increment num variable

p=i; //holding loop value in p variable

y= 0//assign value 0 in y variable

Explanation:

Following are the runtime analysis of the above-given algorithm:

The above-provided algorithm is greedy, but if it doesn't exceed the scope, it operates by greedily choosing its next object. Therefore the algorithm selects the fewest number of pens.

Running time:

This algorithm merely iterates once over all the points. The run-time is therefore O(n).

You might be interested in
What is a characteristic of a wan hub-and-spoke topology?
olga nikolaevna [1]

The characteristic of the WAN hub and spoke topology is that it is considered to be a branch site or composed of the branch site in which they are likely to be connected to a site that is central and that is through the point to point links.

8 0
2 years ago
You should always buy the biggest camera bag that you can find for extra equipment.
Akimi4 [234]

Answer:

true

Explanation:

7 0
3 years ago
Read 2 more answers
Order the steps needed to design a relational database.
tia_tia [17]

Answer:

1. List the fields needed to gain information

2. Break down the date into smaller parts

3. identify the fields holding stored data

4.distribute the fields into tables by subject

5. identify the common fields for linking tables

Explanation:

edge 2021

5 0
3 years ago
Write a for loop to populate array userGuesses with NUM GUESSES integers. Read integers using Scanner. Ex If NUM GUESSES is 3 an
inn [45]

Answer:  

import java.util.Scanner;  

public class StoreGuesses {  

  public static void main (String [] args) {  

      Scanner scnr = new Scanner(System.in);  

      final int NUM_GUESSES = 3;  

      int[] userGuesses = new int[NUM_GUESSES];  

      int i = 0;  

     

      for (i = 0; i < NUM_GUESSES; ++i){  

          userGuesses[i] = scnr.nextInt();  

      }  

      for (i = 0; i < NUM_GUESSES; ++i){  

          System.out.print(userGuesses[i] + " ");  

      }  

  }  

}  

/*

Output:

2 4 6  

2 4 6  

*/

7 0
2 years ago
Terminal emulation, especially the unprotected ____________________ protocol, should be blocked from any access to all internal
storchak [24]

Answer:

telnet

Explanation:

<h2><u>Fill in the blanks </u></h2>

Terminal emulation, especially the unprotected <u>telnet </u>protocol, should be blocked from any access to all internal servers from the public network.

3 0
3 years ago
Other questions:
  • What are Three types of informational references
    9·2 answers
  • What role do you think mobile devices have played in shaping the world?
    13·1 answer
  • Nick is working on a new graphic for one of his company’s clients and is having an issue with the color on his screen. The clien
    8·1 answer
  • What is the wave speed of a wave that has a frequency of 100 Hz and a wavelength of 0.30m?
    5·1 answer
  • Write a pseudo-code that keeps asking the user for a given number 'n' different of zero, then print all numbers between one &amp
    8·1 answer
  • NEED FIVE QUESTIONS ANSWERED!!!
    7·1 answer
  • WILL GIVE BRAINLIEST!!!!!!!
    10·2 answers
  • 1. Describe how research and development influence design. Cite specific examples of how research and development influence desi
    11·1 answer
  • In Subtractive empathy, the counselor responses gives back less (or distorts) than what the client has said. slightly add someth
    14·1 answer
  • Which of the following correctly stores 45 squared in the variable x?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!