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
REY [17]
3 years ago
14

"Suppose that instead of always selecting the first activity to finish, we instead select the last activity to start that is com

patible with all previously selected activities. De- scribe how this approach is a greedy algorithm, and prove that it yields an optimal solution."
Computers and Technology
1 answer:
Pachacha [2.7K]3 years ago
8 0

Answer:

Explanation:

We can say according what we

already know that Greedy algorithm selects the shortest path, and we can also say that the given approach is greedy as it selects the last activity to start as it is the shortest path to take.

Now suppose we are given a set S = {x1, x2,..... , xn} (where x1, x2…. are activities), and xi = [si, fi), and we try to find an optimal solution by selecting the last activity to start that is compatible with all previously selected

activities.

Now create a set S’ = {x’1, x’2, · · · , x’n}, where x’i = [f’i, si). (x’1 = x1 in reverse). We can see that, a subset of {x1, x2, · · · , xn}⊂S is mutually compatible if and only if the corresponding subset {x’1, x’2, · · · , x’n} ⊂ S’ is also mutually compatible. Thus, an optimal solution for S maps directly to an

optimal solution for S’ and vice versa.

The given algorithm when run on S, produces the same result as the greedy algorithm when run on S’. The solution of algorithm for S corresponds to the solution of greedy algorithm for S’, and hence the algorithm is optimal.

You might be interested in
What is better ford our a chevy
blsea [12.9K]
Definitely Chevy. I love chevys.
4 0
3 years ago
Read 2 more answers
After you enter the details for the first selected recipient in the New Address List dialog box, click _______ to add another re
masha68 [24]
B. New Entry

I hope this helps
8 0
3 years ago
Read 2 more answers
Choose the correct function to yield the shown result.
HACTEHA [7]

Answer:

int

Explanation:

Correct on edg test 2021

8 0
3 years ago
Isabella plans to work as a freelance DTP publisher. Her DTP setup is a non-Apple Macintosh platform. She has several options fo
nadya68 [22]
A lot of printers would work. I recommend HP printers because that is what I use and they work great for me.

One of my favorite ones is the HP Deskjet 2543. You can print in black and color, you can copy, and you can scan. Connect it to the computer with a USB port and wait for the computer to recognize it, then you are ready to go. It also supports wireless printing. You can print something from your phone without any cables. How cool is that?
7 0
4 years ago
What code do I have to use in my php if i don’t want my $_SESSION[“variablex”] to destroy? But i already have a session_destroy(
Vesnalui [34]

Answer:

See Explanation Below

Explanation:

Follow the steps below.

1. Start Session

2. Assign the session you want to preserve ( $_SESSION['variablex'] ) to a variable

3. Destroy all session (including the one you want, $_SESSION['variablex'])

4. Reassign the contents of the variable you created in (1) above to $_SESSION['variablex'].

The code is as follows (comments explain each line)

<?php

session_start(); // Start session

$variable = $_SESSION['variablex'] ; // assign $_SESSION['variablex'] to $variable

session_destroy(); // Destroy sessions

$_SESSION['variablex'] = $variable; // assign $variable back to $_SESSION['variablex'] to

// You can continue your code (if you have any), here

// End of solution

?>

5 0
3 years ago
Other questions:
  • Which type of factories began to flourish in the late eighteenth century
    5·1 answer
  • THE DOMAIN IN AN EMAIL MESSAGE TELLS YOU THE
    11·1 answer
  • What is the real meaning of hack and crack?
    6·1 answer
  • A manufacturer wishes to design a hard disk with a capacity of 30 GB or more (using the standard definition of 1 GB = 2^30 bytes
    7·1 answer
  • What are the overheads associated with recursive algorithms? [
    9·1 answer
  • Which of the following files has the Ionic styles? ionic.bundle.css ionic.js ionic.css ionic.bundle.js
    13·1 answer
  • Write a spellcheck() method that takes a word as a parameter and returns true if it is in the dictionary array. It should return
    5·1 answer
  • Plzzz help ya girl out due soon
    13·1 answer
  • Which three staements about gravity and the formation of the solar system are true?
    15·1 answer
  • When adopting and implementing a software as a service (saas) platform such as salesforce for your business, which responsibilit
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!