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
RUDIKE [14]
3 years ago
13

You are running an art museum. There is a long hallway with k paintings on the wall. The locations of the paintings are l1, ...,

lk . These locations are real numbers, but not necessarily integers. You can place guards at locations in the hallway, and a guard can protect all paintings within 1 unit of distance from his location. The guards can be placed at any location, not just a location where there is a painting. Design a greedy algorithm to determine the minimum number of guards needed to protect all paintings.
Computers and Technology
1 answer:
Airida [17]3 years ago
3 0

Answer:

The answer to the algorithm is given below:

Explanation:

Algorithm:

#Define a set to keep track of the locations of the paintings.

location = {l1, l2, l3, l4, …, lk}

#Sort the set of locations.

Sort(location)

#Define a set to keep track of the positioned guards.

set P = {NULL}

#Define a variable to keep track of

#the location of the guard last positioned.

curr_guard = -infinity

#Define a variable to access the

#locations of the paintings.

i = 0

#Run the loop to access the

#location of the paintings.

#Since the location set has been sorted, the paintings

#are accessed in the order of their increasing locations.

while i < k:

#Check if the current painting is

#not protected by the current guard.

if location(i) > curr_guard + 1:

   

   #Assign a guard to

   #protect the painting.

   curr_guard = location(i) + 1

   

   #Add the guard to the set

   #of the positioned guards.

   P = P + {curr_guard}

#Increase the value of

#the variable i by 1.

i = i + 1

#Define a variable to count

#the number of guards placed

count = 0

#Run the loop to count

#the number of guards.

for guard in P:

count = count + 1

#Display the number of guards

#required to protect all the paintings.

print ("The minimum number of guards required are: ", count)

You might be interested in
Which letter would appear in the third position of the standard wheel marking of a hard-grade wheel?
torisob [31]
B is the correct answer you are looking for 

6 0
3 years ago
Read 2 more answers
What is the operation of an earth leakage tester
Vladimir [108]

In any electrical installation, some current will flow through the protective ground conductor to ground. This is usually called leakage current. Leakage current most commonly flows in the insulation surrounding conductors and in the filters protecting electronic equipment around the home or office. So what's the problem? On circuits protected by GFCIs (Ground Fault Current Interrupters), leakage current can cause unnecessary and intermittent tripping. In extreme cases, it can cause a rise in voltage on accessible conductive parts. 


5 0
3 years ago
The 6 steps for PowerPoint competency from the TED talk in the module "How to Avoid Death by PowerPoint."?
KIM [24]

Answer:

1. Do some presentation preparation work

2. Set the right tone and end on a high note.

3. Create sleek and stylish slides.

4. Get your audience to focus.

5. Its all about you.

Explanation:

1. Do some presentation preparation work:

A good presentation begins, not with slides, but with a pencil and paper. Research your audience’s background, interests and capabilities. What do they already know, for instance, and what can they learn from you?

2. Set the right tone and end on a high note:

You have no more than 30 seconds to secure your audience’s attention. So, what attention-grabbing opener will you use?

Visual communications expert Curtis Newbold suggests “a fascinating quote; an alarming or surprising statistic; asking your audience a question; telling a relevant and funny joke… an imaginary scenario; or a demonstration''.

3. Create sleek and stylish slides:

Once you have your story down, you can start to design your slides.  

Before you do, it’s important to think about the practicalities. Will they, for instance, be displayed Widescreen with a 16:9 ratio? Or Standard with 4:3? This might seem like a small detail, but it can make a huge difference in terms of visual impact.

4.  Get your audience to focus:

The most important thing is to grab your audience’s attention straight away – and then maintain it! You want your audience to go away having learned something. So, make it as easy as possible for people to grasp your message “from the off”!

5.  Its all about you:

Finally, remember that, ultimately, it’s you that the audience should be paying attention to, not your slides!

PowerPoint can be used to create great visual aids, but the success of your presentation is determined by the way you deliver them. So, tell your story with a confident, compelling physical presence, and master it by rehearsing it 10 to 15 times.

6 0
3 years ago
Match each malware type to its description
zhenek [66]

1. Trojan Horse

2. Worm

3. Virus

6 0
4 years ago
What are the benefits of building redundancy into a network? What are the potential issues with building redundancy?
dusya [7]

Answer: Network redundancy can be defined as the process of adding the network device, along with a line of communication to provide network availability.

Explanation:

Benefits of building redundancy into a network: It decreases the risk of network failure.

If one server fails to transfer the information, then the backup server will take the charge to help in continuing the communication.

Potential issues with building redundancy: Denial of service and cyber attacks are the threats to network.

Without the use of backup system the one point failure can disrupt the entire system.

8 0
3 years ago
Other questions:
  • Folders are containers used to organize the documents into manageable groups on a designated storage device. true or false
    10·1 answer
  • How can we get the number of records or rows in a table using MySQL? *
    8·1 answer
  • ____ privileges for data involve establishing who can enter new data, change existing data, delete unwanted data, and view data.
    10·1 answer
  • When at the rightmost cell in a row, press the ENTER key to move to the first cell in the next row; do not press the TAB key
    6·1 answer
  • We write programs as a sequence of operation. they flow through the computer as?
    11·1 answer
  • Can someone help me and explain
    5·1 answer
  • ______ requires that any electronic communication must be backed up and secured with reasonable disaster recovery infrastructure
    6·1 answer
  • The success of Eye of the storm exemplifies
    9·1 answer
  • WILL GIVE BRAINLIEST!! NO LINKS!!!
    12·2 answers
  • Which of the following is a benifit of googling yourself ?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!