12. Greedy Algorithms: Minimum Spanning Tree

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 พ.ย. 2024

ความคิดเห็น • 114

  • @freccia9500
    @freccia9500 7 ปีที่แล้ว +242

    Prim's algorithm starts 42:20
    Kruskal's algorithm : 1:06:00

    • @SunnySingh-kn2pn
      @SunnySingh-kn2pn 7 ปีที่แล้ว +4

      you the best!

    • @asmaanaciri9046
      @asmaanaciri9046 7 ปีที่แล้ว +2

      thank you...that's what I'm looking for

    • @yashasgangadhar2109
      @yashasgangadhar2109 5 ปีที่แล้ว +1

      Love ya

    • @varunnarayanan8720
      @varunnarayanan8720 5 ปีที่แล้ว +9

      Inorder to understand why/how Prim's works you need to see the before part of this video as well.

    • @jonsnow9246
      @jonsnow9246 5 ปีที่แล้ว +1

      Careful he's a lord

  • @sgzerolc
    @sgzerolc 2 ปีที่แล้ว +9

    correctness for Prim's algorithm 52:01
    correctness for Kruskal's algorithm 1:15:35

  • @parkamark
    @parkamark 5 ปีที่แล้ว +18

    I've just utilised Kruskal's algorithm to solve a real-world problem we were facing at the company I work at. It is a very simple and elegant algorithm to implement. As of writing, it's solved our requirement of finding a spanning tree of a connected cyclic graph containing around 80 nodes, but we may have future instances with even more nodes (hundreds!). In our setup, none of the edges have weights so it just picks a random edge each time, effectively producing an arbitrary spanning tree upon each invocation of the problem, which is fine for what we need it for.
    Excellent video!

    • @juliancohn7662
      @juliancohn7662 3 ปีที่แล้ว +11

      If the edges have no weight than any search algorithm (dfs, bfs) will find a spanning tree

  • @neerajkrishna1983
    @neerajkrishna1983 4 ปีที่แล้ว +9

    Erik Demaine is one of the best Instructors!

  • @trinhngocdieu
    @trinhngocdieu 3 ปีที่แล้ว +23

    Really appreciate the MIT resource on this. Erik is an amazing teacher!

  • @mohansinghrawat4324
    @mohansinghrawat4324 7 ปีที่แล้ว +16

    Sir Erik you are best at teaching.. thankyou for the support...

  • @LF58888
    @LF58888 ปีที่แล้ว +16

    Im in the top 500 universities, and still finding youtube helping me more then my prof....

    • @cosmic_gate476
      @cosmic_gate476 10 หลายเดือนก่อน +9

      Professors are always excellent researchers, but not always good teachers.

    • @LF58888
      @LF58888 10 หลายเดือนก่อน

      @@cosmic_gate476 yeah thats so true :***(

  • @inadaizz
    @inadaizz 3 ปีที่แล้ว +2

    I really enjoy this professor. Thank you MIT and Professor Demaine.
    Regards from The University of Toledo.

  • @ryancocuzzo6322
    @ryancocuzzo6322 6 ปีที่แล้ว +10

    Wow. This guy is good. Very impressed with this lecture.

    • @aw6507
      @aw6507 3 ปีที่แล้ว

      yeah dude is a genius

  • @PeterHoward-r6p
    @PeterHoward-r6p 3 หลายเดือนก่อน

    I really like the old style by using chalks and blackboards especially their snappy sounds

  • @hannahdo980
    @hannahdo980 4 ปีที่แล้ว +14

    That was a valuable lecture... But that chalkboard almost gave me mild asthma 😂

  • @shivanshmishra752
    @shivanshmishra752 2 ปีที่แล้ว

    First time in my life loving the proofs

  • @Adi1995cv
    @Adi1995cv 8 ปีที่แล้ว +3

    Perfect Textbook lecture. Thank you

  • @hemantdhanuka5919
    @hemantdhanuka5919 7 ปีที่แล้ว +40

    Totally Impressed with U sir , why i find u so late... u are fanstastic teacher

  • @AshishKumar-zx6zz
    @AshishKumar-zx6zz 2 ปีที่แล้ว +1

    One of the best teachers

  • @TheKarateKidd
    @TheKarateKidd 4 ปีที่แล้ว +3

    This guy is a pro at writing on a chalkboard.

  • @fracturedude
    @fracturedude 6 ปีที่แล้ว +10

    @27:05 in what situation is w(T') < w(T* - e)? Isn't w(T') = w(T* - e)?

    • @archidar1
      @archidar1 4 ปีที่แล้ว +4

      Before he wrote that he said that T' is the minimum spanning tree of a graph with G/e nodes.
      So by definition w(T')

    • @이효건-o4o
      @이효건-o4o 3 ปีที่แล้ว

      @@archidar1 thx i've been looking for this

  • @scrappy-mvp
    @scrappy-mvp 5 หลายเดือนก่อน

    The proof of the greedy choice property is incorrect. You can’t exchange any edge crossing the cut with e to get the MST but you have to find the edge that is part of the cycle when you add e. And this uses the property of a cut that if an edge that crosses a cut is part of a cycle then there’s another edge of that cycle that crosses the cut too. And this cycle edge may or may not be the current edge we’re trying to exchange in the Tree.

  • @pourkavoosmedicalllcpourka7429
    @pourkavoosmedicalllcpourka7429 2 ปีที่แล้ว

    What an excellent lecturer! Very clear and concise.

  • @AlexandrBorschchev
    @AlexandrBorschchev ปีที่แล้ว

    Amazing instructor

  • @eeee8677
    @eeee8677 6 ปีที่แล้ว +50

    man I wish I went here );

    • @kushnayak1619
      @kushnayak1619 4 ปีที่แล้ว +1

      ok

    • @eeee8677
      @eeee8677 4 ปีที่แล้ว +28

      Two years later! I completed my B.S. in Computer Science ya'll!

    • @kushnayak1619
      @kushnayak1619 4 ปีที่แล้ว +4

      good

    • @fake_tourist
      @fake_tourist 3 ปีที่แล้ว

      @@eeee8677 congratulations!

    • @ayushsingh562
      @ayushsingh562 2 ปีที่แล้ว

      @@eeee8677 way to go!!

  • @kevnar
    @kevnar 3 ปีที่แล้ว +2

    Corporations pay employees as little as possible: the greedy choice. But if all corporations paid employees abundantly, they'd make more sales when the public has more disposable income, and they'd be richer in the long run. The locally optimal solution is not always the best.

  • @dr.mohamedaitnouh4501
    @dr.mohamedaitnouh4501 ปีที่แล้ว

    Does anyone know which microphone this professor is using? really crisp and clear! thanks!

    • @mitocw
      @mitocw  ปีที่แล้ว

      It was most likely a wireless lav microphone from Sony. Not sure what exact model... it was seven years ago.

  • @soumadipranjanbiswas1779
    @soumadipranjanbiswas1779 4 ปีที่แล้ว +2

    Thank You. Sir, you are an amazing teacher. Thank you for your videos, they are so clear and easy to understand. However, I'm a little confused still about the running time of Prim's. Would anyone be able to explain how you can decrease a key in a Fibonacci heap in constant time? If you were implementing prim's with a regular min-heap, would the running time change from O(Vlog(V) + E) to O(Vlog(V) + Elog(V)) to reflect the slower decrease key operation? (normal heaps, as I understand, take log(n) time to decrease the value of a key, correct?)

  • @eiebfiebrkcfne5399
    @eiebfiebrkcfne5399 4 ปีที่แล้ว +2

    33:04 exchange argument (cut and paste argument)

    • @lumiere2598
      @lumiere2598 3 ปีที่แล้ว +1

      yea the name confuses me, and turns out it is just the exchange argument 😂

  • @kentemershonyucra3251
    @kentemershonyucra3251 8 ปีที่แล้ว

    Its correct proof the optimal substructure only by cut y paste that show in Cormen in programming dynamic chapter, if T* = T contracting a edge, and T = w(edge) + T*, suppose that T is minimum, if T* is not minimum, I can copy a minimum spanning tree T** here and, we get a T not is minimum, what is a contradiction.

  • @journeytowardslife9830
    @journeytowardslife9830 3 ปีที่แล้ว

    Erik is a genius !

  • @hectorbarajas9670
    @hectorbarajas9670 7 ปีที่แล้ว +1

    @30:38 he says a crossing edge is defined by whether or not it has a vertex in V and the other vertex not in V. Did he mean to say a vertex is in S and the other is not in S?

  • @wolfinthesuit
    @wolfinthesuit 3 ปีที่แล้ว

    Thanks you MiT now i hate science and hate algorithm and hate myself for failing

  • @inordirectional
    @inordirectional 5 ปีที่แล้ว +1

    What an excellent teacher.
    However, I'm a little confused still about the running time of Prim's. Would anyone be able to explain how you can decrease a key in a fibonacci heap in constant time? If you were implementing prim's with a regular min-heap, would the running time change from O(Vlog(V) + E) to O(Vlog(V) + Elog(V)) to reflect the slower decrease key operation? (normal heaps, as I understand, take log(n) time to decrease the value of a key, correct?)

    • @yosrym93
      @yosrym93 5 ปีที่แล้ว

      Yes.
      Given that you are using an adjacency list:
      Fibonacci Heap Priority Queue -> O(|V|.log|V| + |E|)
      Min-Heap Priority Queue -> O((|V|+|E|)log|V|)
      If you are using a matrix instead of adjacency list, for every V you will loop through all vertices instead of just its degree, however, you still perform operations only when there is an edge. So:
      Min-Heap -> O(|V^2| + (|V| + |E|) log |V|) -> O(|V|^2 + |E| log |V|).
      Fibonacci Heap -> O(|V|^2 + |V| log |V|) -> O(|V|^2).
      |V| -> # of Vertices
      |E| -> # of Edges

    • @juliogomez1850
      @juliogomez1850 2 ปีที่แล้ว

      @@yosrym93 bro be honest are you a robot

  • @emanabdelhaleem7561
    @emanabdelhaleem7561 11 หลายเดือนก่อน

    It's was a shock for me and a good push too knowing that even professors at MIT need to look to a paper while building a proof!

  • @intuitivej9327
    @intuitivej9327 3 ปีที่แล้ว

    Wow...!i like his lecture.

  • @yifanxu3423
    @yifanxu3423 6 ปีที่แล้ว

    @ 25:41 isn't that T* was cut to two subtrees since he was deleting the edge instead of merging it? can we say two trees is a spanning tree then?

    • @mystmuffin3600
      @mystmuffin3600 4 ปีที่แล้ว

      No he deletes the edge AND merges the vertices, so it's still a single spanning tree. He says that like literally seconds later - "Contraction preserves connectivity"

  • @ninadsachania3652
    @ninadsachania3652 2 ปีที่แล้ว

    Great lecture!

  • @Loukas_Anastasiadis
    @Loukas_Anastasiadis 7 ปีที่แล้ว +2

    wish i could i understand what you say man, i really tried. thanks for the support though.

  • @bernardoamorim9495
    @bernardoamorim9495 8 ปีที่แล้ว

    Are both vertices sets from the example starting @ 14:20 supposed to be connected on the spanning tree, with paths that do not include the edge e?

    • @hekkenikken
      @hekkenikken 8 ปีที่แล้ว

      If I understand your question, you're asking if both U and V are part of the MST. Answer is yes, because if edge e={u,v} is part of the MST then both vertex U and vertex V has to be part of the MST.
      Also for your second question "which paths do not include edge e={u,v}?", the answer it that there can be many paths which do not include that edge. Those paths a higher cost than the path edge e={u,v} is part of, and therefore does not create a MST.

  • @kyniemxotxa98
    @kyniemxotxa98 7 ปีที่แล้ว

    doesn't the picture @ 19:20 says that the graph is cyclic? But spanning trees are acyclic. Looks like a case of a bad example, or am I missing something?

    • @chrisfischer5380
      @chrisfischer5380 7 ปีที่แล้ว +4

      Spanning tree must be acyclic but that doesn't mean the graph has to be

    • @anonymoususer5402
      @anonymoususer5402 7 ปีที่แล้ว

      Graph is cyclic and spanning trees are not

  • @somerandomguy8361
    @somerandomguy8361 4 ปีที่แล้ว

    Where is recitation 3 lecture?

    • @mitocw
      @mitocw  4 ปีที่แล้ว

      Sorry, recitation 3 is not available.

  • @mtslr7378
    @mtslr7378 ปีที่แล้ว

    Lucky, I didn't take those kind of classes.

  • @WorldOfPersianDoc
    @WorldOfPersianDoc 2 ปีที่แล้ว

    I'm preparing for my PhD algorithm qualifying exam and this video helps me to understand the proof. However, signs are too much and they can be more simplified. Also, class notes helped but the graphs are not in the class notes which could be so much useful to understand the proof easier.

    • @War4Skills
      @War4Skills 2 ปีที่แล้ว

      complain more

  • @JiuxiM
    @JiuxiM 3 ปีที่แล้ว +2

    Since the last lecture, Eric has been trying to emphasize that purple is better than blue. Whereas in lecture 10 Srinivas said blue is better than purple. Interesting...

  • @ajinkyagaikwad5888
    @ajinkyagaikwad5888 5 ปีที่แล้ว

    awesome

  • @niteeshchaturvedi2754
    @niteeshchaturvedi2754 6 ปีที่แล้ว +3

    after watch 1 hour of super cool lecture, my brain is still blank .will anyone suggest a brain booster tonic ?:( :)

  • @mdaud1995
    @mdaud1995 7 ปีที่แล้ว

    @17:00 onwards, if an edge(red) from 1st part ends in 2nd part, then the graph would not be an MST...but we have already supposed it to be a MST with e being an edge....
    Please clarify this doubt....!

    • @mystmuffin3600
      @mystmuffin3600 4 ปีที่แล้ว

      if you delete edge e (and the components are still connected), you are in essence creating a new MST with a min red edge

  • @mostafasaadinasab6338
    @mostafasaadinasab6338 5 ปีที่แล้ว

    #besten#Episode#Liebe#Soll#schönen#Highlight#

  • @3alabo
    @3alabo 4 ปีที่แล้ว

    this guy is so fucking awesome

  • @jonathanibarra8236
    @jonathanibarra8236 4 ปีที่แล้ว +3

    I think the camera man is the best attentive and hope he’s taking notes too lol

  • @papetatedouces
    @papetatedouces 4 ปีที่แล้ว

    18:00 best way to contract an STD

  • @mons911
    @mons911 2 ปีที่แล้ว

    I wanted to be on those benches! 💔

  • @user-tk2jy8xr8b
    @user-tk2jy8xr8b 5 ปีที่แล้ว

    > tree = directed connected acyclic graph
    a ->- b ->- d
    └-->- c ->-┘
    according to the definition this must be a tree, but it's not

  • @bernardoamorim9495
    @bernardoamorim9495 8 ปีที่แล้ว

    @38:05, what if u and u' are connected by a path that includes e' ?

    • @adamrichter8792
      @adamrichter8792 4 ปีที่แล้ว

      I believe that Professor Demaine made a slight error at 36:25 relevant to your question in his writing of a proof that every least weight edge that crosses a cut of an (undirected) graph is part of a minimum spanning tree of that graph. Just before that, he talked about how, given a possibly different minimum spanning tree, T*, there was a unique path from u to v in T* and that that unique path also must cross the cut, but then he did not use that lemma in writing the proof. In his proof, he wrote that we could choose any edge e' in T* that crosses the cut. I think he meant to put a further condition on e' that it must also be one of the edges in the path from u to v within T*. That way, removing e' disconnects the subgraphs containing u and v, and then adding e reconnects them without creating a cycle.

  • @ivyhe7234
    @ivyhe7234 8 ปีที่แล้ว

    What's the thing with the frisbee?

    • @arbadon
      @arbadon 8 ปีที่แล้ว +3

      Each time someone gives a valid answer/proposal on one of the professors questions, they get a frisbee, although it used to be pillows!

  • @mohamedayssarbenelhedi2207
    @mohamedayssarbenelhedi2207 8 ปีที่แล้ว

    how can i get acces to more lessons and PDF files , i am a student at a german university " RWTH aachen and i am interesed in having the textbooks to read please

    • @mitocw
      @mitocw  8 ปีที่แล้ว +3

      See the course on MIT OpenCourseWare for more course materials (lecture notes, exams with solutions, assignments with solutions, recitations) at ocw.mit.edu/6-046JS15.

    • @mohamedayssarbenelhedi2207
      @mohamedayssarbenelhedi2207 8 ปีที่แล้ว +1

      Yeah thnx I have checked , but some of them are limited , I don't have full access , for exemple I want operating system concepts , there is only notes , but no full lecture

    • @andrewspencer22
      @andrewspencer22 8 ปีที่แล้ว

      Not every class has lectures. Generally what you see on the site is the resources they have.

  • @shashwattyagi1417
    @shashwattyagi1417 4 ปีที่แล้ว +1

    17:30

  • @maxyakovlev505
    @maxyakovlev505 6 ปีที่แล้ว

    43:32
    seems like nicki minaj has been using prims algorithm to grow her ass

  • @RamshaRana
    @RamshaRana 7 ปีที่แล้ว +1

    so cool (y)

  • @danielnzuma9070
    @danielnzuma9070 8 หลายเดือนก่อน

    Added this comment cause I cant like twice
    Thanks Eric

  • @rachitrajput915
    @rachitrajput915 4 ปีที่แล้ว

    Itne saare black board.......

  • @qaz123amangupta
    @qaz123amangupta 5 ปีที่แล้ว +1

    i cant understand

    • @tr233
      @tr233 5 ปีที่แล้ว +1

      you are not alone, but exerciese think about out what the condition what the small steps

  • @meredithsui9532
    @meredithsui9532 4 ปีที่แล้ว

    confusing

  • @shrimatkapoor2200
    @shrimatkapoor2200 4 ปีที่แล้ว +1

    Why is my professor so shit, he literally reads of slides.. And doesn't even make sense doing it

  • @holdenmcgroin8917
    @holdenmcgroin8917 5 ปีที่แล้ว

    This guy writes too much

  • @autumnleaves9917
    @autumnleaves9917 8 ปีที่แล้ว

    too much writing. Why didn't he use a powerpoint

    • @surajkakkad7363
      @surajkakkad7363 6 ปีที่แล้ว +40

      powerpoint kills actual thinking.

    • @ilyakopyl
      @ilyakopyl 6 ปีที่แล้ว

      Such online lectures were my motivation to learn the cursive writing (not native speaker) and fast writing.

    • @dylancutler1978
      @dylancutler1978 6 ปีที่แล้ว +12

      It's for the benefit of the students, it takes time to write it by hand, time they also need to write notes at a pace that allows them to continue to pay attention while also understanding what they are writing.
      This stuff requires thought to understand, and even MIT students need time to grasp new information.

    • @TheKarateKidd
      @TheKarateKidd 4 ปีที่แล้ว +4

      My university banned teachers from using PowerPoint during math/science lectures. It eliminates demonstrating the entire thought process and pace behind the critical thinking needed to learn and solve these concepts.

  • @hariharane51
    @hariharane51 8 ปีที่แล้ว

    worst 1 hr i ever spent !!!

  • @phangb580
    @phangb580 3 หลายเดือนก่อน

    16:29