Prim's Algorithm - Graphs | Minimum Spanning Tree(MST) in Graphs | Code and Implementation

  Рет қаралды 48,058

Pepcoding

Pepcoding

Күн бұрын

Пікірлер: 79
@vikashgupta3305
@vikashgupta3305 3 жыл бұрын
@ 9:14, He is such a awesome teacher agar ye chahte toh bolskte the ki video rewind Krke fir se dekhlo but he did the same dryRun again ❤️. Respect ++🙏
@divyanshacharya3796
@divyanshacharya3796 3 жыл бұрын
I was not able to understand why we used Prims instead of Dijkstra, but at @ 16:48 he told to find difference in answers if graph was different and when I did it the confusion went away, he is by far the best teacher for learning DSA that too FREE. Hats off to you sir.
@shanmukhchandrayama8508
@shanmukhchandrayama8508 3 жыл бұрын
This is the best video on youtube for prims, really thrilled on knowing
@Pepcoding
@Pepcoding 3 жыл бұрын
wow, this cheers me up. I am glad we at pepcoding could be of help to you. Keep learning. Also, recommend us to your juniors and peers, they may also benefit.
@tusharmahajan7754
@tusharmahajan7754 3 жыл бұрын
if someone still confused in difference between dijkstra and prim. In prim you have to cover all the vertices but in dijkstra its not necessary. Solve the last graph with 25 weight sir gave it will be cleared.
@JEAnandkumar
@JEAnandkumar 3 жыл бұрын
Best Explanation of prims ever found on you tube!!
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad it was helpful. Keep learning, Keep growing and keep loving Pepcoding!😊
@Nandishswarup
@Nandishswarup 3 жыл бұрын
Have seen other videos too of the same concept.... but so far this is the best explanation of this problem.. 👍👍
@kartikeydixit3743
@kartikeydixit3743 3 жыл бұрын
Are bhai bhai bhai bhai!!!!!!!!!!!!!!!!!!!!!!! . Sir you are Legend in the field of DS Algo. You can make any algorithm simple , and also you are the USP of pepcoding , so I would request you to continue making DS videos.
@Pepcoding
@Pepcoding 3 жыл бұрын
Thank you for appreciating. The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos. So, keep motivating, keep learning and keep loving Pepcoding😊
@vaibhavtripathi832
@vaibhavtripathi832 2 жыл бұрын
With Prim's algorithm we find minimum cost spanning tree. The goal is to find minimum cost to cover all nodes. with Dijkstra we find Single Source Shortest Path. The goal is find the shortest path from the source to every other node
@mptapasdas
@mptapasdas 3 жыл бұрын
best explanation available on youtube
@parasrawat7287
@parasrawat7287 2 жыл бұрын
Difference in the answer if we consider the question given at 17:05 Dijkstra- reaching 6 would take 0346 or 03456 Prims- reaching 6 would take 0123456
@alpishjain1317
@alpishjain1317 3 жыл бұрын
sir please upload advance graph playlist also i have completed the whole playlist and i just love your teaching.
@namanjain9922
@namanjain9922 3 жыл бұрын
Let's do some practice together ,share good questions with me on my whatsapp haha😂😂😂😂
@namanjain9922
@namanjain9922 3 жыл бұрын
Which language do you prefer ? Java.
@ashwinigupta821
@ashwinigupta821 2 жыл бұрын
Great content sir🙏. Typo in the thumbnail of this one.
@ASHISHSINGH-gs3yt
@ASHISHSINGH-gs3yt 2 жыл бұрын
Such a simple and amazing implementation of prims. This is what i had in my mind but thought i was wrong because everyone was using 3 vector for some reason. Thanks thank you again.
@yashgaur1716
@yashgaur1716 2 жыл бұрын
That was too awesome! Thanks for the content sir
@hemantvardani1436
@hemantvardani1436 2 жыл бұрын
Thanks, ..very simple approach used compare to other solutions available on yt
@aritralahiri8321
@aritralahiri8321 3 жыл бұрын
Beautifully explained !
@vivekpaliwal1876
@vivekpaliwal1876 2 жыл бұрын
Bhot badiya vedio ..your channel will be so successful. The way you teach is simply awsome
@Pepcoding
@Pepcoding 2 жыл бұрын
Glad you liked it! For better experience, visit nados.io, where you will get well curated content and career opportunities.
@amanpreetsinghsetia1524
@amanpreetsinghsetia1524 3 жыл бұрын
Very Nicely Explained!
@Pepcoding
@Pepcoding 3 жыл бұрын
Glad it was helpful! For more content like this please visit nados.pepcoding.com
@dsa3334
@dsa3334 3 жыл бұрын
Great Explanation. Thank you sir
@kush76
@kush76 3 жыл бұрын
Sir you are awesome And your way of teaching is feel like i am listening this in front of you 🔥
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@Star_Bawa9
@Star_Bawa9 2 жыл бұрын
Thank you crystal explaination
@sahil5496
@sahil5496 3 жыл бұрын
Amazing video
@manabsaha5336
@manabsaha5336 3 жыл бұрын
Bhaiya, can you upload more graph related algorithms like Kruskal's and Bellman Ford's.. etc.?
@shivanigupta9747
@shivanigupta9747 2 жыл бұрын
Please cover flyod warshall also.
@yashvarshney6761
@yashvarshney6761 3 жыл бұрын
@Pepcoding Graphs ki bhi porri playlist daal do youtube pe. Itna kar diya toh thoda or, please
@priyankajhamb7061
@priyankajhamb7061 2 жыл бұрын
Sir, Can you please tell us what is the time complexity of this prim's algorithm code?
@garvwadhwa4871
@garvwadhwa4871 3 жыл бұрын
MST without source, then we'll traverse from 0 to n-11 nodes. In gfg it's showing TLE. Sir please upload optimized way of prim's
@kunalsihare5244
@kunalsihare5244 3 жыл бұрын
Sir pelease make more videos on algorithms and data structures asked in Mnc interviews🙏🙏
@ditu-kunalsarda6863
@ditu-kunalsarda6863 4 жыл бұрын
SIr! If the vtces (4--6) had a weight of 5 then for minimum spanning (4-6) vtces should have been selected but from this code it wont be selected. It will still take the (4-5) and (5-6) path
@reyazahmed9320
@reyazahmed9320 3 жыл бұрын
4-6 does not include vertex 5. That's why
@neerajnegi1447
@neerajnegi1447 3 жыл бұрын
Check your code for Dijkstra's it will work fine but here in prims it checks for the minimum edge weight by not taking previous weights for comparison, so in this question, the shortest distance to 6 will be comparing it with the min(5--6, 4--6) which will be 5--6.
@ankitgautam279
@ankitgautam279 4 жыл бұрын
Sir MySQL and SQL ke lecture suggest kar dijiye jo apki tarah padata ho.
@nandinibagga4857
@nandinibagga4857 3 жыл бұрын
saare topics miljate hain is channel par :)
@Pepcoding
@Pepcoding 3 жыл бұрын
Thank you so much and If you like the content could you post something on LinkedIn about us? This will help us in reaching out to more people and help a lot of other students as well Something like this Sumeet Malik from Pepcoding is making all his content freely available to the community You can check it out here - www.pepcoding.com/resources / Also, this is the youtube channel - kzbin.infoplaylists?view_as=subscriber
@goodpeople7615
@goodpeople7615 4 жыл бұрын
Sir please upload dynamic programming adv wale ques , final year walo Ka bhala ho jayega
@Pepcoding
@Pepcoding 4 жыл бұрын
beta foundation ke graphs ka last video bna rha hun. aj he levelup shuru hoga.
@anssha2643
@anssha2643 4 жыл бұрын
@@Pepcoding Sir graphs k level up k vidoes ka link kahan hai?
@rahulballani7775
@rahulballani7775 3 жыл бұрын
Why does it give TLE on gfg even though if we are doing a BFS, I GUESS we are marking visited while popping instead of pushing , Are we doing a lot of extra work in rm*wa*?
@madhavchaturvedi4654
@madhavchaturvedi4654 3 жыл бұрын
sir please kruskals pe bhi video banao
@aman6561
@aman6561 4 жыл бұрын
Thank you so much sir
@Pepcoding
@Pepcoding 4 жыл бұрын
I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem. If you like my efforts, I request a review g.page/Pepcoding/review?rc
@aman6561
@aman6561 4 жыл бұрын
@@Pepcoding already done sr
@letsdoeverythinginoneweek9398
@letsdoeverythinginoneweek9398 3 жыл бұрын
maza aa gaui
@Pepcoding
@Pepcoding 3 жыл бұрын
Thankyou beta! I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem. If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )
@creativegiant148
@creativegiant148 3 жыл бұрын
Basically primes is more greedy.
@siddharthrawat7063
@siddharthrawat7063 2 жыл бұрын
Hi Sumit, please do make video on Kruskal's Algo. Already made video is really poor. Please help
@Pepcoding
@Pepcoding 2 жыл бұрын
Feedback taken, for better experience and well organised content sign up on nados.io and start learning.
@ankushgupta630
@ankushgupta630 4 жыл бұрын
Please cover "circle of strings" on geeksforgeeks
@Pepcoding
@Pepcoding 4 жыл бұрын
Ok
@ankushgupta630
@ankushgupta630 4 жыл бұрын
@@Pepcoding waiting
@geetanegi2736
@geetanegi2736 4 жыл бұрын
To get placement kis hisab sa mujha serial vise video dekhni chahiya .I have no knowledge about it .pls guide me I have passed class 12.
@Pepcoding
@Pepcoding 4 жыл бұрын
This is the proper to do these questions www.pepcoding.com/resources/online-java-foundation
@geetanegi2736
@geetanegi2736 4 жыл бұрын
Thnk you sir
@CuriousAnonDev
@CuriousAnonDev 2 жыл бұрын
time complexity kyu nai samjai sir :(((
@kasturisanyal6649
@kasturisanyal6649 3 жыл бұрын
can you provide a C++ code for this ?
@shanayagupta4002
@shanayagupta4002 Жыл бұрын
koi sir ki videos ke notes bna rha hai kya? agar haa toh please reply
@Prodcater
@Prodcater 3 жыл бұрын
hi sir isko 2D matrix me input leka sove karna hua toh kaise karnege ...jaisa input leetcode aur gfg pe diya hua hai
@ojasdighe991
@ojasdighe991 3 жыл бұрын
usko adjacency list me convert karo
@hymnish_you
@hymnish_you 4 жыл бұрын
Sir, Bellman Ford or Kruskal's jaroori hain?
@Pepcoding
@Pepcoding 4 жыл бұрын
hanji jaroori hai
@akshaykhanna4295
@akshaykhanna4295 3 жыл бұрын
Anayatha 🙂
@Pepcoding
@Pepcoding 3 жыл бұрын
Visit - nados.pepcoding.com and sign up to NADOS. Don't forget to follow us on Instagram instagram.com/pepcoding/
@angadrajsingh4311
@angadrajsingh4311 4 жыл бұрын
Sir kruskal pe bhi question kara dijie
@Pepcoding
@Pepcoding 4 жыл бұрын
level2 mei
@umangkumar2005
@umangkumar2005 2 жыл бұрын
this concept is not applicable on some other question we are not able to solve other question using this concept
@hardikgupta7306
@hardikgupta7306 4 жыл бұрын
Sir Kruskals algo ki video kidhar hai ?
@Pepcoding
@Pepcoding 4 жыл бұрын
beta foundation prims pe khatam kar dia. Level2 ke graphs mei daalunga kruskals. Wo thoda padhane mei samjhane mei jyada time leti hai
@lavishgarg4274
@lavishgarg4274 4 жыл бұрын
@@Pepcoding Sir thode aur acche questions daaliye,bhut shi pd rhe ho aap,mze aa jaate he,aur bilkul bhi bhulne nhi dete aap phle ka,bhut baar revise kra dete ho. Thanks for all this.
@VijayKumar-bj8pe
@VijayKumar-bj8pe 4 жыл бұрын
I have two doubts 1) what is the time complexity of this algo? 2) which is better, prims or kruskal?
@palakgupta4104
@palakgupta4104 3 жыл бұрын
i think complexity is same as that of dijkstra elogv
@jobanpreetsingh2370
@jobanpreetsingh2370 3 жыл бұрын
1.Time -O(vertices + edges) Space - O(vertices)
3.5 Prims and Kruskals Algorithms - Greedy Method
20:12
Abdul Bari
Рет қаралды 2,9 МЛН
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
SIZE DOESN’T MATTER @benjaminjiujitsu
00:46
Natan por Aí
Рет қаралды 3,5 МЛН
G-45. Prim's Algorithm - Minimum Spanning Tree - C++ and Java
19:10
take U forward
Рет қаралды 271 М.
L-4.9: Prim's Algorithm for Minimum Cost Spanning Tree | Prims vs Kruskal
9:55
Lecture 96: Minimum Spanning Tree || Prim's Algorithm
33:04
CodeHelp - by Babbar
Рет қаралды 147 М.
G-47. Kruskal's Algorithm - Minimum Spanning Tree - C++ and Java
13:11
take U forward
Рет қаралды 200 М.
L-4.8: Kruskal Algorithm for Minimum Spanning Tree in Hindi | Algorithm
11:17