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
Need help ASPA!!!!!!!!!
professor190 [17]
Answer is D the internet
7 0
3 years ago
Read 2 more answers
According to which virtue do you need to secure information by limiting computer access to authorized personnel only ?
nadya68 [22]

Confidentiality is a virtue which we need to secure information by limiting computer access to authorized personnel only. People trust us to keep their private matters private. Keeping that confidence is an important aspect of trust.  

8 0
3 years ago
Read 2 more answers
When you build a computer from parts, you usually start by deciding on which processor and motherboard you will use?
loris [4]
The thing to look for is compatible RAM, Processor and motherboard. Then I would choose my graphics card, hard drive, etc.
3 0
3 years ago
I know that this will be taken down for not being a real question but is anyone else not able to search for anything? I can type
Schach [20]

Answer:

Sameee

Explanation:

6 0
3 years ago
In short and brave what is technology?
emmainna [20.7K]

Answer:

technology is a whole means to provide goods needed for the survival and comfort of human life

8 0
3 years ago
Read 2 more answers
Other questions:
  • What computer system was the first to run the unix operating system?
    11·1 answer
  • Describe how using active listening at work can help you be a better employee.
    15·1 answer
  • Do routers have ip addresses? if so, how many?
    10·1 answer
  • Answer all 1).The most common layout of keys on the keyboard is the _____ keyboard. ASDF QWERTY JKL QWOPY,
    5·2 answers
  • Choose all of the items that represent functions of the operating system kernel.
    15·2 answers
  • Which describes which CTSO each student should join?]
    7·1 answer
  • " _____ is a measure of the amount of information that can travel from a user to the Internet in a given amount of time."
    9·1 answer
  • How can you crop a photo in PowerPoint?
    15·2 answers
  • This is for being Weird!
    15·2 answers
  • List at least 5 professions for people working in the Information/Communication<br> fields.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!