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
Please help i will mark brainliest (15 Points ) HELP PLEASE
igor_vitrenko [27]

The answer should be; 729 cm^3

8 0
3 years ago
Read 2 more answers
Sally was walking to Ocean Front Housing Complex, In miles, how far is her distance?
Vanyuwa [196]

Answer:

Sally is 10 miles

The coordinate ofthe deli is (1, -1)

Step-by-step explanation:

✍️Coordinate of Sally = (-3, 2)

Coordinate of Ocean Front = (5, -4)

The distance of Sally to Ocean Front Housing Complex = the distance between point (-3, 2) and (5, -4).

Use the distance formula, d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}, to calculate the distance between (-3, 2) and (5, -4):

d = \sqrt{(5 -(-3))^2 + (-4 - 2)^2}

d = \sqrt{(8)^2 + (-6)^2}

d = \sqrt{64 + 36}

d = \sqrt{100} = 10

✅The distance of Sally is 10 miles

✍️the coordinate of Deli would be half the distance between Sally and Ocean Front.

Therefore, use the midpoint formula to calculate the coordinate of the midpoint between Sally (-3, 2) and Ocean Front (5, -4).

Midpoint of (-3, 2) and (5, -4).

M(\frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2})

Plug in the values

M(\frac{-3 + 5}{2}, \frac{2 +(-4)}{2})

M(\frac{2}{2}, \frac{-2}{2})

M(1, -1)

✅The coordinate ofthe deli is (1, -1)

8 0
3 years ago
The equation of the line that contains diagonal HM is y = 2/3 x + 7.
nirvana33 [79]

Answer:

The slope of the line that contains diagonal OE will be = -3/2

Step-by-step explanation:

We know the slope-intercept form of the line equation

y = mx+b

Where m is the slope and b is the y-intercept

Given the equation of the line that contains diagonal HM is y = 2/3 x + 7

y = 2/3 x + 7

comparing the equation with the slope-intercept form of the line equation

y = mx+b

Thus, slope = m = 2/3

  • We know that the diagonals are perpendicular bisectors of each other.

As we have to determine the slope of the line that contains diagonal OE.

As the slope of the line that contains diagonal HM = 2/3

We also know that a line perpendicular to another line contains a slope that is the negative reciprocal of the slope of the other line.

Therefore, the slope of the line that contains diagonal

OE will be = -1/m = -1/(2/3) = -3/2

Hence, the slope of the line that contains diagonal OE will be = -3/2

3 0
3 years ago
Factor the expression 2^2 +4-12
alekssr [168]

It can't be

There is no variable

4 0
3 years ago
What is the equation of the trend line in the scatter plot ?
ryzh [129]

Answer:

Equation: -3x + 18

Hope this helps!

6 0
3 years ago
Other questions:
  • Math diagonal polygon 50 points
    11·2 answers
  • Need help with Trigonometry!
    11·1 answer
  • The sum of three numbers is 24. the largest number is three times the smallest, and the middle number is four less than the larg
    8·1 answer
  • What prime numbers go Into 108
    14·1 answer
  • If c(x) = 5/x-2 and d(x) = x+3, what is the domain of (cd)(x)?
    12·1 answer
  • A driver in a car traveling at a speed of 21.8 m/s sees a cat 101 m away on the road. How long will it take for the car to accel
    12·1 answer
  • HELP ASAP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    11·2 answers
  • Choose and then match the ratio which is equivalent
    7·1 answer
  • 1. How are polynomials added and subtracted?
    10·2 answers
  • Please answer the image below
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!