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
Multiple Choice
podryga [215]

Answer:

a

Explanation:

Boolean Operators are simple words (AND, OR, NOT or AND NOT) used as conjunctions to combine or exclude keywords in a search, resulting in more focused and productive results. ... Proximity Operators (with, near and others) can also help you in searching.

5 0
3 years ago
An html element that describes the content of a web page is called a(n):
Marizza181 [45]
I think its <tagname> content right here </tag name>
3 0
3 years ago
A man-in-the-middle attack or impersonation are likely to result in problems with
Ivan

Answer:

Data Confidentiality

Explanation:

A Man-In-The-Middle-Attack (MITM) is an attack when a hacker gets between a communicative situation and digitally eavesdrops.

6 0
3 years ago
Software that manages and supports the resources of a computer is known as?
irakobra [83]
The answer to this question is

<span>Systems software are programs that manage the resources of the computer system and simplify applications programming. They include software such as the operating system, database management systems, networking software, translators, and software utilities.


If you taken a computer course, it tells you this information.

Hope This Helps!
:D
</span>
3 0
3 years ago
I'm making a game. I'm trying to make it so that instead of how I currently have it, starting whenever I click the screen, it st
Lera25 [3.4K]
That’s cool I’ll play the game tonight if I can
6 0
3 years ago
Other questions:
  • A bunch of computer scientists take over an island and start their own country. They want the license plates to use binary numbe
    11·1 answer
  • When paying bills online, a payee is:
    9·1 answer
  • What are three metrics used to define consistent network application availability?
    5·1 answer
  • How to bold words in microsoft word
    10·1 answer
  • An array similar to a phone book has 1000 names arranged as names [0], names[1]....names[999]. Nancy wants to search a name X in
    15·1 answer
  • 3.1.14 Wormhole CodeHS <br><br> May I have it in a copy and paste, please?
    5·1 answer
  • Before u can open and edit a file, you need to zip it, T/F
    12·1 answer
  • Please answer questions in complete sentences!
    14·1 answer
  • Write a short essay about the best rotary-wing aircraft ever. It must be a specific aircraft and consist of three paragraphs. In
    9·1 answer
  • 2.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!