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
A nursing informatics specialist is preparing an in-service program for staff on healthcare informatics and information technolo
Snezhnost [94]

Answer:

A- information

Explanation:

According to my research on nursing informatics specialists, I can say that based on the information provided within the question the nurse would emphasize information as the primary focus. This is because knowing what healthcare informatics entails as well as having the knowledge of how to use the technology is the most important aspect of the job.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

5 0
3 years ago
Can you help me with Computer issues graphic organizer?<br> Will give out brainly
tino4ka555 [31]
Just put for first: coding, graphics and for second : designing, writing
Third?: put all of the abov
6 0
3 years ago
3. Which of the following is a single piece of information related to the person, place,
stepan [7]
I think the answer is field
8 0
3 years ago
Read 2 more answers
The science of networking is attributed to which government's involvement?
worty [1.4K]

Answer:

The United States

if I am not mistaken

6 0
3 years ago
Which type of mountain is formed due to the collision of two different kinds of plates?
Lyrx [107]
D) Andean mountains are formed due to the collision of two different kinds of plates.
6 0
3 years ago
Read 2 more answers
Other questions:
  • In a social networking site your personal information is listed under your inbox. home. status. profile.
    11·1 answer
  • What system of representation is used for the threaded portions
    12·1 answer
  • Around what time did the Internet come around and how did it all start? Would like to know more of the history of how the intern
    12·1 answer
  • The ____ class act as a switchboard between the view layer and the domain layer.
    14·1 answer
  • If you wish to maintain a consistent style to all the documents you create, it would be helpful to use a _​
    5·1 answer
  • Systems Software, Inc., is introducing a new piece of sophisticated graphics software. A recently hired writer has been assigned
    8·1 answer
  • Question 4 (Multiple Choice Worth 5 points)
    6·1 answer
  • After you configure backup settings using the backup plugin, backup jobs will run automatically and start taking backups at the
    13·1 answer
  • Write a set of nested loops that display 10 rows of # characters. There should be 15 # characters in each row.
    15·1 answer
  • I NEED HELP, DO ASAP <br> Why do you have to adjust toys for different ages?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!