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
Klio2033 [76]
3 years ago
12

Your job is to prepare a lineup of n awardees at an award ceremony. You are given a list of m constraints of the form "i wants t

o receive an award before j." If you violate a constraint, it might upset the affected award recipient (i) and then i may leave the ceremony. Give an algorithm that prepares such a lineup, (or says that it is not possible) in O ( m + n ) time.
Mathematics
1 answer:
DanielleElmas [232]3 years ago
6 0

Answer:

The idea is to use the concept of topological sorting.

Complexity of this algorithm is equal to complexity of DFS algorithm, that is, O(m+n).

Step-by-step explanation:

The idea is to use the concept of topological sorting.

A topological sort also called a topological ordering of a directed graph is a linear ordering of its vertices in a way that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, and the edges may represent constraints that one task must be performed before another; in this application, a topological ordering is just a valid sequence for the tasks.

A topological sorting is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph (DAG).

For every edge (U - - >V), create a directed edge from U to V.

While creating an edge, if an edge creates a cycle, then it is not possible.

n= number of awardees

m= the number of constraint

Let n represent the vertices of a graph and constraints m is representing edges of a graph.

and graph is represented in adjacent of O(m+n)

Constraint i wants to receive award before j

Graphical representation - - - - - > (i) - - - - - - > (j) j depends on i

1. Presently run topological olding on graph G(n, m) where n is vertices and m is edges.

2. Run DFs on Graph, a temporary stack

3. Firstly call topological sorting for all its adjacent vertices and then push it to a stack. Finally, print content of stack.

4. Vertex is push to stack only when all adjacent vertices are already in stack.

Complexity of this algorithm is equal to complexity of DFS algorithm, that is, O(m+n).

You might be interested in
PZ HELP!!!!!! ITS A TEST!
Softa [21]

Answer:

bruh

Step-by-step explanation:

bruh u never even put the question

7 0
3 years ago
Read 2 more answers
Plzz helpp I’ll mark brainiest
Andru [333]
Answer is year 3
Ben 19
Amy 22
3 0
3 years ago
Read 2 more answers
What value of x satisfies
LenaWriter [7]

Answer:

See explanation

Step-by-step explanation:

The given trigonometric equation is cos(90-x)=-\frac{\sqrt{3} }{3}.

We take the inverse cosine of both sides to get:

90-x=cos^{-1}(-\frac{\sqrt{3} }{3})

90-x=125

x=125-90

x=-35\degree=325\degree to the nearest degree

None of the options satisfies the given equation.

But if the question is actually;

cos(90-x)=-\frac{\sqrt{3} }{2}

Then;

90-x=\cos^{-1}(-\frac{\sqrt{3} }{2}).

90-x=210.

90-x=210.

x=-120\degree.

Or

x=360-120=240\degree.

In this case the answer will be B

5 0
3 years ago
Read 2 more answers
4535 divided by 83 = R =
Leto [7]

Answer:

54 R 53

54 53/83

Step-by-step explanation:

4535 divided by 83 equals

54 with a remainder of 53

8 0
3 years ago
£72 shared in the ratio of 2:7
Goryan [66]
To do that we have to add 2+7=9
Next step is to divide 72 by 9
72:9=8 - its how many pounds its in"1"
Finally we can multiply 
2*8=16
7*8=56 - its the answer
8 0
3 years ago
Other questions:
  • I WILL NAME BRAINLIEST PLZ HELPP!!!!
    6·1 answer
  • Add or subtract, represent each equation with a number line subtract -28 - (-16)=
    6·1 answer
  • Salma is saving money to buy a game. So far she has saved
    7·2 answers
  • A-3b=4;2a=6b-9 Answer by elimination, please include the entire work on how you got to your answer. According to my math teacher
    12·1 answer
  • Dawn earned $97.50 for 10 hours of work. Amy earned $120 for 12 hours of work.How much did each person earn per hour? How can yo
    7·2 answers
  • Answer correctly for a brainliest I promise I will give you one of its correct
    9·1 answer
  • 2x + y = −3<br> 3x + 2y = −8
    8·1 answer
  • Help <br> Fjdjdjdjdjdjdjdjdjdj
    8·1 answer
  • Select the equation(s), where 9 is a solution.
    10·1 answer
  • The illustration below shows the graph of yyy as a function of xxx.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!