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
Which is the length of x? 1 7/9 2 1/2 1 1/4 1 3/5
trapecia [35]

Answer:

option D.  x = 1 3/5

Step-by-step explanation:

ratio and proportion

<u> 4 </u> = <u> x </u>

5     2

X multiply:

5x = 4(2)

5x = 8

x = 8 / 5

x = 1 3/5

5 0
3 years ago
Read 2 more answers
Solve for W <br> V = L + W
Elena L [17]

Answer:

W = -L + V

Step-by-step explanation:

V = L + W

~Subtract L to both sides

V - L = W

Best of Luck!

5 0
3 years ago
Subtract 0000 1000 whats the answer
Finger [1]
If u subtract 1,000 - 0000 it will equal 1,000

8 0
3 years ago
Which state ment is true regarding the graphed function
jek_recluse [69]

Answer:

F(-2)= g(-2)

Step-by-step explanation:

F(-2)= g(-2), both function have the same points of intersect.

5 0
3 years ago
H(x)= 2x+1, Find h(3)
zvonat [6]
H of three is 7 Bc you just plug it in
8 0
2 years ago
Read 2 more answers
Other questions:
  • Just need an answer ASAP to pass this class.
    7·2 answers
  • Determine a when d=6, g=4, k=3
    7·1 answer
  • Find measure of angle 2
    10·2 answers
  • Please Help!! (brainliest fr best answer)
    10·1 answer
  • A local art studio offers a new session of drawing classes every 12 days. A competing art studio offers a new session of drawing
    5·1 answer
  • Choose the product of –3y2(–4y3 + y – 9).
    7·1 answer
  • Can someone please help me​
    11·1 answer
  • F(x) x^2-2x+3= -2x+ 28
    6·1 answer
  • A survey of 280 homeless persons showed that 63 were veterans
    10·1 answer
  • If the rate of inflation is 3.9% per year, the future price p(t) (in dollars) of a certain item can be modeled by the following
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!