Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given n classes A 1 , , An such that each Ai is associated with [ si , fi ] where si and

You are given n classes A1,, An such that each Ai
is associated with [si, fi] where si and fi denote the start and the finishing time of Ai. You are to select the maximum number of classes that can be scheduled in a single classroom such that no two activities
can be scheduled unless they do not have an overlapping period. Consider the following two
algorithms. Only one of them produces an optimal solution. For each algorithm, prove its
correctness or give a counter example to disprove it.
Algorithm 1: Sort the activities according to their start times such that s1<= s2<=<= sn.
Consider activities A1, A2, An in this order, and schedule Ai to the room if it does not overlap with any class already scheduled.
Algorithm 2: Sort the activities according to their finishing times such that f1<= f2<=<=fn. Consider activities A1, A2, An in this order, and schedule Ai to the room if it does not overlap with any class already scheduled.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

=+What are the motivations behind your purchase decisions?

Answered: 1 week ago