Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose you have n lectures that need to be allocated to available classrooms. Each lecture i has a start time si and finish time fi.

image text in transcribed
image text in transcribed
Suppose you have n lectures that need to be allocated to available classrooms. Each lecture i has a start time si and finish time fi. Your goal is to assign lectures to rooms using as few rooms as possible. Of course, if two lectures overlap in time, they cannot share a room. (a) Consider the following greedy algorithm skeleton: 1 Sort lectures in some way (tbd) 2d0 3 for j1 to n do if lecture j is compatible with some classroom k then schedule lecture j in classroom k else allocate a new classroom d+1 schedule lecture j in classroom d+1 dd+1 You remember that you learned about interval scheduling in class, and for that problem you needed to sort by finish times. Show by counter-example that sorting by finish times doesn't always work here. (b) Prove that sorting by start time always gives the optimal solution. (c) Show that your algorithm is O(nlogn)

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

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago