subject

Suppose we have a number of events mi. Each event starts at time si and finishes at time ei, where 0 <= si <= e. We represent the event mi with the closed interval [si, ei]. Our goal is to construct a maximum size set of events, where no two events in the set overlap (note that two events mi and mj where mi = [., x] and mj = [x, .] are not considered to overlap). Suppose the following intervals are provided.

Event Index Interval
A [1,4]
B [2,3]
C [3,6]
D [5, 9]
E [7,11]

Required:
a. Give the optimal set of events for this example set of intervals.
b. Consider the following greedy approach: at each step, select the event with the earliest starting time that does not conflict with any event already in our set. Show that this approach is not optimal by providing the greedy solution generated by this approach for the above example intervals.
c. Consider a second greedy approach: first order the events by length. Then, at each step, select the event with the shortest length that does not conflict with any event already in our set. While this approach generates the optimal set for the above example, it is not guaranteed to do so for this problem generally. Give a set of 5 intervals for which this second greedy approach fails to generate the optimal solution. Explicitly state both the optimal solution and the solution generated by this approach for your example.
d. State a greedy approach to this problem that always finds the optimal solution.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 12:50
Write a new lc-3 trap subroutine (i.e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i.e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e.g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e.g. b0000 0000 0000 0111 =
Answers: 3
question
Computers and Technology, 24.06.2019 15:00
When a presentation is being planned, it is important to ensure that it covers all available information. appeals to the audience. uses multimedia tools. entertains the audience.
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Which type of cloud computing offers easily accessible software and applications on the machines
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
Which of the following best describe how the depth-limited search works. a normal depth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but the number of ply/depths is limited. a normal breadth-first search is performed but values above a specific value will be ignored. a normal depth-first search is performed but values above a specific value will be ignored.
Answers: 1
You know the right answer?
Suppose we have a number of events mi. Each event starts at time si and finishes at time ei, where 0...
Questions
question
Chemistry, 17.02.2021 20:40
question
Mathematics, 17.02.2021 20:40
question
Mathematics, 17.02.2021 20:40
question
Mathematics, 17.02.2021 20:40
question
Business, 17.02.2021 20:40
question
Health, 17.02.2021 20:40
Questions on the website: 13722362