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
What are the solutions to the system of equations? {y=x2−4x+8y=2x+3
OverLord2011 [107]

Answer:

1) C  2) (-2,0) 3) 4)  5) c )S={(0,3)} 6) (0,2) 7)  8) Missing graph 9) Vertical line (check below) 10) B 11)

Step-by-step explanation:

1) Solving by the Addition/Elimination Method. Firstly, let's reduce one variable by making some algebraic adjustments and then adding it up:

2) Solving by Substitution Method. Where y=x+2 is plugged in the 2nd equation.

3) Solving it, again, by the Substitution Method due to the I equation form:

4) By the Addition Method

5) To use the graph method to solve the system of Linear equations is possible by graphing each equation on the Cartesian Plane.

Check the graph below, this system has only one solution.

c)S={(0,3)}

6) Solving y=-1/3x+2 y=x+2

(Check the graph below)

A) A) (0, 2)

7) Solving by Substitution Method:

8) Missing graph

9)

Check the graph below its answer

10) Solving by the Addition Method

11) Sorry, missing graph for the question.

12) Sorry, missing graph for the question.

13) D Check the graph below

14) Sorry, missing graph for the question.

5 0
3 years ago
Determine the volume of the rectangular prism please.
Juliette [100K]

Answer:

192cm^3

Step-by-step explanation:

V=Bh

B= 1/2bh

B= 16

h=12

V= Bh= 16 x 12= 192

just an FYI- this is a triangular prism

6 0
3 years ago
Need urgent help ignore mine already attempts
MrMuchimi

Answer:

0.50

Step-by-step explanation:

There are two outcomes when flipping a coin, heads or tails, and one of them is heads so the probability is 1/2 = 0.50.

5 0
3 years ago
Read 2 more answers
Please explain to me to have a better understsning. . .​
dem82 [27]

For the first one:

m is the slope, or how much the line goes up compared to goes right.  In this case, the line goes up 40 every time it goes right 10.  We write this as a fraction so 40/10, which simplifies to 4.  Therefore the equation would be y = 4x.

7 0
3 years ago
Help please this my little brother work
masha68 [24]
Huh? What do you mean I don't understand
7 0
3 years ago
Read 2 more answers
Other questions:
  • B(n)=4-6(-1)<br> find the 4th term in the sequence
    15·1 answer
  • KLM has vertices K(1, –4), L(–3, 3), and M(–5, –1). KLM is translated so that K’ is located at point (–3, 2). State the coordina
    5·1 answer
  • The price of a new car is $29,990. If the sales tax rate is 6.5%, then how much sales tax is being charged? What is the total co
    6·1 answer
  • Help please 10 points
    15·2 answers
  • Sum of 3/10 and 62/100
    7·1 answer
  • The national mean SAT score in math is 550. Suppose a high school principal claims that the mean SAT score in math at his school
    8·1 answer
  • Can someone answer the question plz?
    10·2 answers
  • Help me please with this question
    10·1 answer
  • Plz answer I will give brainlest tag
    10·1 answer
  • HELP I AM TIMED !!! WHAT IS F(6)? i don’t understand
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!