Algorithms Lecture 17: Greedy Algorithms, Room Scheduling Problem (Interval Graph Coloring)

  Рет қаралды 8,876

Ghassan Shobaki Computer Science Lectures

Ghassan Shobaki Computer Science Lectures

Күн бұрын

Пікірлер: 11
@blingket
@blingket 4 жыл бұрын
Thank you so much, it was exactly what I needed
@Faad3e
@Faad3e 4 жыл бұрын
grande fran suscrito altok
@fabiancid2053
@fabiancid2053 4 жыл бұрын
grande Leopoldo suscrito altok
@RedEnergySounds
@RedEnergySounds 4 жыл бұрын
Sir, thank you for the great lecture, pretty straightforward and simple to understand. But may I ask one question? What happens if an activity is bound to a resource? For example what happens if a3 should be on r1 and we can't change it? Won't a1 overlap? Thank you
@赖清德-w8f
@赖清德-w8f 4 жыл бұрын
thank you for your lecture, very clear. in the code, you need to sort events by time ascending order and event type alphabetically ascending order, right? otherwise it's likely s2 is before f1 in the list because they have same time. another question is in the code, we need a different way to capture which activity is assigned which room I think, otherwise, if it's a start event, we assign Event[i].activity.room = room, but when we process finish event for the same activity, Event[i].activity.room is empty, because the room is set in activity's start event.
@abhishekchaudhary6975
@abhishekchaudhary6975 3 жыл бұрын
Thank you!!
@Maxwellpaulwall
@Maxwellpaulwall Жыл бұрын
There is nothing in the sort algorithm that guarantees if S1, S2, S3, ... Sn and F1, F2, F3, ... Fm are equal, that they will appear in alternating order. This means the algorithm encounter all the start times with time = x, before all the finish times with time = x. The algorithm will assign new rooms before realizing an event ended in a room that was already used. To fix this I would suggest modifying the sort algorithm to make sure the Fi comes first if its equal to an Si, or perhaps change the datastructure and way of checking it.
@ghassanshobakicomputerscie9478
@ghassanshobakicomputerscie9478 Жыл бұрын
Yes, you are absolutely right. Thank you for catching this subtlety! Making sure that finish times appear before start times in the sort is an implementation detail that we don't necessarily mention in the pseudo-code. Of course, mentioning this in the pseudo-code would make it more precise. However, pseudo-code will never be as precise as real code that is written in a specific programming language.
@inkuumba
@inkuumba Жыл бұрын
@@ghassanshobakicomputerscie9478 This ordering was mention in the video at minute around 13.18. It wasn't an oversight. Thanks Prof. for your videos
@asdfasdfuhf
@asdfasdfuhf 5 жыл бұрын
What chaptor in CLRS touches upon the room sceduling problem (interval graph coloring) ?
@ghassanshobakicomputerscie9478
@ghassanshobakicomputerscie9478 5 жыл бұрын
Good question! It is not covered in any section, but it is introduced in the Third Edition as Problem 16.1-4 on Page 422. I cover it, because I think it is an excellent example of a problem that is NP-complete in its general form (Graph Coloring) but has a special case (Interval Graph Coloring) that can be solved using an extremely simple and intuitive nlogn greedy algorithm, and this special case happened to have many interesting applications in practice.
Algorithms Lecture 18: Dynamic Programming, 0-1 Knapsack Problem
1:14:42
Ghassan Shobaki Computer Science Lectures
Рет қаралды 10 М.
Algorithms Lecture 19: Dynamic Programming, Longest Common Subsequence and Longest Common Substring
1:02:33
Ghassan Shobaki Computer Science Lectures
Рет қаралды 10 М.
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 5 МЛН
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,5 МЛН
СКОЛЬКО ПАЛЬЦЕВ ТУТ?
00:16
Masomka
Рет қаралды 3,4 МЛН
Interval Scheduling Maximization (Proof w/ Exchange Argument)
20:20
Back To Back SWE
Рет қаралды 65 М.
Greedy Algorithm and Proof of correctness by induction
22:19
Geeky Me Library
Рет қаралды 45
6.3 Graph Coloring Problem - Backtracking
15:52
Abdul Bari
Рет қаралды 1,2 МЛН
What REALLY Happened in Amsterdam
15:04
Double Down News
Рет қаралды 745 М.
Algorithms Lecture 16: Greedy Algorithms, Proofs of Correctness
20:11
Ghassan Shobaki Computer Science Lectures
Рет қаралды 33 М.
Introductory Calculus: Oxford Mathematics 1st Year Student Lecture
58:03
Oxford Mathematics
Рет қаралды 10 МЛН
Algorithms Lecture 2: Asymptotic Complexity (Part 1)
1:15:10
Ghassan Shobaki Computer Science Lectures
Рет қаралды 15 М.
Dijkstra's Algorithm - Computerphile
10:43
Computerphile
Рет қаралды 1,3 МЛН
Algorithms Lecture 6: Solving Recurrences Using the Recursion Tree Method
1:13:31
Ghassan Shobaki Computer Science Lectures
Рет қаралды 10 М.
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 5 МЛН