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
Question 2 Unsaved Which of these is NOT an example of an emerging technology? Question 2 options: Sixth Sense Close Range Drone
alexandr1967 [171]

The answer is <em>B.) Close Range Drones</em>

I just took the test

3 0
3 years ago
Blogs may refer to any kind of communication over the internet is true​
Sliva [168]

Answer:

Yes It's true but You forgot email

Explanation:

6 0
3 years ago
What pointer appears when pointing to a hyperlink
Leokris [45]
Your answer would be: a hand pointer.
6 0
3 years ago
Read 2 more answers
Productivity, rework, and technology impact are examples of which kind of software metric?
fgiga [73]

The correct answer should be process type of software metric. The process metrics are used to help in strategic decision making. The processes such as work products delivery, expended human hours and conformance to quality and schedule are all metrics in the process domain.

6 0
3 years ago
Consider the following line of code: if (x &lt; 12 || (r – 3 &gt; 12)) Write three valid mutants of this ground string (based on
Nata [24]

Answer:

See explaination

Explanation:

Mutation Testing:

Mutation Testing is a type of software testing where we mutate (change) certain statements in the source code and check if the test cases are able to find the errors. It is a type of White Box Testing which is mainly used for Unit Testing. The changes in the mutant program are kept extremely small, so it does not affect the overall objective of the program.

We say a mutant is valid if it is syntactically correct. We say a mutant is useful if, in addition to being valid, its behavior differs from the behavior of the original program for no more than a small subset of program test cases.

VALID MUTANTS

1. if (x < 12 && (r – 3 > 12)) LOR

2. if (x < 12 || (r – 3 < 12)) ROR

3. if (x < 12 || (x – 3 < 12)) IVR

INVALID MUTANTS

1. if (x < 12 ||(r – 3 > 12) UPR

2. if (x < 12 (r – 3 < 12)) MLO

3. (x < 12 || (x – 3 < 12)) CSM

Note:

LOR: LOGICAL OPERATOR REPLACEMENT

ROR: RELATIONAL OPERATOR REPLACEMENT

IVR: INVALID VARIABLE REPLACEMENT

UPR: UNBALENCED PARANTHISIS REPLACEMENT

MLO: MISSING LOGICAL OPERATOR REPLACEMENT

CSM: CONTROL OPERATOR MISSING REPLACEMEN

4 0
3 years ago
Other questions:
  • The columns of a spreadsheet data source are A. form letters. B. the mailing list. C. data points. D. fields.
    12·1 answer
  • Ada lovelace designed the first computer
    7·1 answer
  • Which statement best describes multimedia
    14·1 answer
  • 1. What is JavaScript?
    15·1 answer
  • What type of engineer is interested in designing, developing, and building different machines, devices, and tools? A.aerospace
    8·2 answers
  • It is impossible to use a computer without a mouse. Is this statement true or false?
    10·1 answer
  • Karl comes across confidential information. What should he do with it? A. Manipulate the information in his favor B. Sell the in
    12·1 answer
  • Describe five examples of civil engineering projects.
    6·1 answer
  • In this exercise, you are asking the user to set a alpha numeric password for any website. Put some conditions.
    8·1 answer
  • Give 3 reasons why it is believed that smart phones precent us from communicating face to face.give three reasons why it is beli
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!