Prim's Algorithm | Minimum Spanning Tree | Full Dry Run | INTUITION | Graph Concepts & Qns - 34

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

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

  • @codestorywithMIK
    @codestorywithMIK  ปีที่แล้ว +34

    Small correction: 19:11 --- The parent of 3 is 2 not 1
    🙂

    • @chandankumar-gv1hz
      @chandankumar-gv1hz 10 หลายเดือนก่อน +3

      I spent 20 mins thinking why.. 😌

    • @shubhamjaiswal7645
      @shubhamjaiswal7645 6 หลายเดือนก่อน

      @@chandankumar-gv1hz same with me bro

    • @DeadCode_Debugs
      @DeadCode_Debugs 2 หลายเดือนก่อน +1

      @@shubhamjaiswal7645 mujhe bhi doubbt aaya hi thaa ,,,but 2 also comest after 1 thats why i thought it was right ...but it was wrong

  • @wearevacationuncoverers
    @wearevacationuncoverers ปีที่แล้ว +13

    3:56
    I bet no one can build intuition like this but you bro

  • @ShivamMishra-xd8nn
    @ShivamMishra-xd8nn หลายเดือนก่อน +2

    maja aa gya bhaiya 🥰🥰🥰 can't explain you the satisfaction level,
    khud se dry run kiya pahle jo jo apne bola ha phir vdo dekha and khud code v kiya

  • @Mr.NerdNexus
    @Mr.NerdNexus 16 ชั่วโมงที่ผ่านมา +2

    I follow you just because,
    Other TH-camrs teach you main concept
    But
    You at first teach us how to overcome fear by teaching fundamentals first , then you teach main concept
    That's really helpful to weak student like me...
    And ofc in a group 95% are weak as me ...
    Not everyone is brilliant and we do not compare with them
    That also you teach us

    • @codestorywithMIK
      @codestorywithMIK  16 ชั่วโมงที่ผ่านมา +1

      I am so glad to hear that! ❤️🙏

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

    Intuition koi nai batata itne dedication se and dry run bhi ❤

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

    Now Prims algorithm will be retained in my mind for all time. All thanks to you 👌🏻

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

    One notification from your channel is enough to cheer me up.

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

    Bro I am getting obsessed with your explanation day by day ❤ just keep doing man it is really helpful.. respect++

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

    King of GRAPHS
    DSA 🔥🔥🔥🔥

  • @gaurimandot5788
    @gaurimandot5788 2 หลายเดือนก่อน +1

    I feel happy when I see, you have uploaded a solution which I am looking for. Best of best !!😁

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

    3:56 NO ONE CAN TEACH LIKE YOU ❤

  • @meetz_0166
    @meetz_0166 8 หลายเดือนก่อน +2

    just when i started this video i already knew a visited array and a min heap will be required i guess that's what you call a intuition.
    thank you so much i couldn't have thought once that i would come this far

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

    waiting for dp playlist too your explanation is too good

  • @AdityaRaj-xm6oi
    @AdityaRaj-xm6oi ปีที่แล้ว +2

    Elder brother I subscribed to you just at the moment you explained the intuition.

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

      It means a lot to me Brother.
      Thank you ❤️😇🙏

  • @Cheerlessguy
    @Cheerlessguy 3 หลายเดือนก่อน +1

    Great video. I feel it is very much similar to Dijkstra. Just that in Dijkstra we maintain a dist array and in Prim we maintain a visited array as we don't want to find shortest distance. Once node is processed we can simply skip it.

  • @AlishaKhan-ww3io
    @AlishaKhan-ww3io ปีที่แล้ว +2

    I will never forget it. Best explanation ❤

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

    Your explanations are top notch. Code yaad nhi rakhna padta ab bas intuition yaad reh jata h ab❤

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

      That’s the motive. Intuition should be there always.
      So glad to hear. Thanks a lot ❤️❤️

  • @gui-codes
    @gui-codes 4 หลายเดือนก่อน

    I will never forget this. you are an amazing tutor

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

    No one.....i repeat no else motivates like u do🥹

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

    nice video and explanation a small correction needed 19:11 the parent of 3 is 2 not 1 and rest of the things are just awsome

  • @atifakhtar8828
    @atifakhtar8828 4 หลายเดือนก่อน +2

    make this guy education minister of india .....

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

    Very well explained with intuition

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

    awesome explanation!

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

      Thank you so much Divyansh ❤️❤️🙏

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

    OP Graph Series

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

      I am so glad to hear that.
      Thanks a lot ❤️🙏

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

    at 8:00 why did you not consider the edge of (3,4) which has wt of 1. if we start from right side, we will have to include this right

    • @ruchirshrikhande5584
      @ruchirshrikhande5584 9 หลายเดือนก่อน

      We are given the vertices and edges so why would you start from vertex 4 and then go to 3?Wouldnt you always start from 0 and then go to 3?Besides even if we visit from right you'd still get the same sum and path . irrespective of whether you go from vertex v-1 to vertex 0 or vertex 0 to vertex v-1 you'd still choose the edges with minimum weight to achieve maximum possible sum while maintaining v-1 edges for v vertices condition

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

    3:56 I bet no one can build intuition like this

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

    i will definitely say One day this chanel become most popular channelthankyou so much

  • @eprithvikushwah4754
    @eprithvikushwah4754 3 หลายเดือนก่อน +1

    19:27 Parent of 3 = 2 ;

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

    34/40 done ✅ thanks a lot bhaiya❤✌

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

    34/41 done [8.12.23] ✅✅

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

    Thanks brother 🙏

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

    thank you sir

  • @Ryminders
    @Ryminders 2 หลายเดือนก่อน +1

    Bdiya.

  • @AmarjeetKumar-to9ub
    @AmarjeetKumar-to9ub ปีที่แล้ว +2

    Thank You :)

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

      You're welcome! 😊❤️

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

      Today’s POTD - th-cam.com/video/QIu9HeyEjPc/w-d-xo.htmlsi=N7C15PELOKP0UjDS

  • @MohitGupta-ml4st
    @MohitGupta-ml4st หลายเดือนก่อน

    can we use ordered set instead of priority queue like we used in dijsktra ?

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

    Sir, how to develop the intuition to solve problems, because your approach of examining does have a smooth flow.

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

      Hi Aman,
      Always first try to go for the brute force.
      It gives you a rough idea where the solution can be optimised and then proceed.
      And solve qns , keep practising. Only that will help

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

    Thanks a lot

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

    Pls clarify my confusion sir ,
    If i change weight between 5-6 vertex 2 to 8 then path should be
    4
    2/ \4 weight 5----6= 8
    /. \. &4-----5-----6 total=10
    5. 6
    But algorithms will give answer 4-5-6 because of 2 different ways from 4 , one is 2 weighted & another one is 4 weighted , but if we choose 4-5-6 path , sum = 10 while 4 to 5 & 4 to 6 gives 2+4= 6 only

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

    awesome explanation bro, just one thing do we need to check both times one while adding to queue and one just after popping from queue? or just one check should work?
    also about the parent thing can we mark the starting node(0) as the parent of every other node since that is our starting point and everything is getting connected to that node indirectly one by one?

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

      Marking 0 as the parent will make the graph all together different because it will seem that all the nodes are connected directly to 0 which is not the case.

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

      Good qn.
      Actually you should add both the check because, it will unnecessarily add unwanted edges in the priority queue might unnecessarily make the while loop run more.
      And your 2nd part of the Qn is correctly answered above by @wearevacationuncoverers . Hope this helps ❤️❤️

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

      @@wearevacationuncoverers yess right i imagined it wrongly every node should have previous node only as parent

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

      @@codestorywithMIK yaa correct its better to be safe n have both the checks

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

    please complete this series

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

      Yes yes, more videos coming as soon as I get back to India 🙏😇

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

    U r an angel in our life bhaiya..🥹

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

    Thnx

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

    Bro please make video on agressive cow and book allocation problem.

  • @kushagrajohra416
    @kushagrajohra416 5 หลายเดือนก่อน

    What if we don't store parent of any node?

  • @Abyssal_Ink
    @Abyssal_Ink 7 หลายเดือนก่อน

    so min heap= priority queue

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

    tc : EV logV right?

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

    ❤❤❤

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

    Mast bhasan diya 😊 I was losing confidence

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

    Nice

  • @rev_krakken70
    @rev_krakken70 7 หลายเดือนก่อน

    How is this different from djikstra

  • @pratik.784
    @pratik.784 ปีที่แล้ว +1

    Sir graph par aur videos chahiye please 🥺

  • @rev_krakken70
    @rev_krakken70 7 หลายเดือนก่อน

    I can see that in djikstra we don't consider parent..

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

    Can we say this is a greedy algorithm as we are taking the smallest edge at every step.

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

      yes this is indeed greedy approach

  • @knight-z1x
    @knight-z1x 4 หลายเดือนก่อน +1

    good morning sir.