You can directly initialise a vector while creating it vector key(n+1,INT_MAX);
@chandrabhanbahetwar96382 жыл бұрын
YES
@muzammilaltafmulla5 ай бұрын
But then you would be doing it in 3 O(n) loops... While you could just do it all in a single loop as shown by Sir...
@akashjha8222 жыл бұрын
Imtehan hogyi thi intzaar ki, finally you are back ❤️
@utkarshsingh3319 Жыл бұрын
Wrong lyrics 😂
@usernamewhatsoever4557 Жыл бұрын
32:50 just noticed lecture - 1 ke 2.6 million views hain almost 40 videos tak 500k se zyada hain and lecture no.90 ke baad not even 1 lakh 60k, 40k, 50k sab videos par But course quality 10 on 10 h bhaiya
@codingindisguise Жыл бұрын
0:24 and 32:20 I can completely relate to you bhaiya...completing this course at one shot dedicatedly is impossible...IT TAKES TIME...😇
@Failed55552 жыл бұрын
Bhaiya is back 🔥🔥kitni khusi ho raha hai bhaiya ko firse dakhke
@nishantsah69812 жыл бұрын
Bhaiya we really appreciate your efforts and there are geniunly people who wait for your videos on youtube. So never get affected by what people says.... you take your time and bring videos....we all want solid concept from you♥️♥️♥️♥️♥️
@jayantgupta5310 Жыл бұрын
Code using Priority queue : #include vector calculatePrimsMST(int n, int m, vector &g) { // create adjacency list unordered_map adj; for(auto i : g) { int u = i.first.first; int v = i.first.second; int w = i.second; adj[u].push_back({v, w}); adj[v].push_back({u, w}); } // min heap to get node with minimum weight priority_queue pq; // let source as 1, and inititally distance of source is 0 // {weight, node} pq.push({0, 1}); vector key(n+1, INT_MAX), parent(n+1, -1), visited(n+1, 0); parent[1] = -1; // weight to reach i is key[i] key[1] = 0; while(pq.size()) { int w = pq.top().first; int node = pq.top().second; visited[node] = 1; pq.pop(); // find node with minimum weight and to to its neighbour for(auto neg: adj[node]) { int toGo = neg.first; int toGoWeg = neg.second; // if to react node N from key[N] update weight(key[N]) with distance from node to N if(visited[toGo] == 0 && toGoWeg < key[toGo]) { key[toGo] = toGoWeg; parent[toGo] = node; pq.push({toGoWeg, toGo}); } } } vector ans; // loop from 2 because parent of 1 is -1 (1 is initial node) for(int i = 2; i
@meerakoul41672 жыл бұрын
The way of your explanation is completely another level sir literally whenever i study from your lectures when i revise it again there is no need to look back on the notebook for reference everything is crystal clear. Thanku Sir
@varunbatra97062 жыл бұрын
Babbar bhaiya is back
@soumya17132 жыл бұрын
One thing i realized that if someone learns all the concepts from u his dsa concepts will be in next level. 🤩
@harshikyadav60352 жыл бұрын
please KZbin k dsa wale course pe bhi focus Karo bhaiya It's a huge request And I really appreciate and happy for your success in edtech
@harshkumar7686 Жыл бұрын
Bhaiya aapko kisi ki baat par dhyan dene ki jaroorat nahin hai aap apni taraf se 100% quality deliver kar rahe ho with full dedication . Thank you so much for your efforts
@lokeshdewangan430 Жыл бұрын
Bhaiyya , line no. 31 why we are ending for loop to only i
@deepakjain72598 күн бұрын
I think that's because all the nodes in adjacent to last node would be covered in previous iterations as it is undirected graph
@me_079_aashishkumarnayak6 Жыл бұрын
The people who write bad comments here are those people who have not come here to learn DSA but who are our love babbar bhaiya's enemies and spammers. who just want to stop his progress and success and to decrease his motivation. True learner can't write like these even can't think about these type of bad comments because if someone is watching his playlist from starting then I am dam sure he/she can't think about bad comments. Don't pay attention to these types of bad comments bhaiya you are really doing a lot for us❣❣really appreciate.
@muhammadsuleman8936 Жыл бұрын
The lecture was super babbar bhayyaa... Amazing DSA course ever on the internet...
@KACodes2 жыл бұрын
Bhaiya hasu ya rou 😂😂 New video ki khushi..... Next video late aane ka darr Par fir bhi #BelieveInBabbar
@sukhjitsingh9592 жыл бұрын
Theek hai Babbar Sir ...we know you will complete your commitment....so thanks
@user-zn3be9ik1x2 жыл бұрын
Sir so nicely you have explained this some day this series is going to be popular for sure.
@aashishrangdal96142 жыл бұрын
Ab ye consistency rukni nhi chahiye😅⚡
@abhishekgamer60972 жыл бұрын
Bhaia I hope now from this point onwards you will be consistent. Thank you ❤️
@sukhjitsingh9592 жыл бұрын
Babbar sir you are saying true there is other work and things at home ... So I remember that your were making vedio during covid infection.... So really respectful for you .... I can understand everything ..so thanks lot
@PIYUSH-lz1zq2 жыл бұрын
bro ...key[i] < min yeee samaj nahi aaya ...while traversing key arr elements in that are 2 3 6 how it can me smaller than min ??? please tell
@fenil_panseriya96912 жыл бұрын
Present bhaiya !! Consistency 🔥🔥🔥 Maza aa gaya 😄
@PRIYANSHUKUMAR-un9zu2 жыл бұрын
Present bhaiya🔥💯 Op bhaiya after long time🤩🔥🔥🔥
@javadotcode2 жыл бұрын
I saw your video till the end bhaiya .. and wait for your ba .. Bye .. Your are really a great person .. Love You always ..
@VishalGupta-xw2rp2 жыл бұрын
Heartiest Congratulations in advance bhaiya for 150K Subscriber..... Many Subscriber will come and go but i will stay with you till the end ♥️
@laksh63182 жыл бұрын
Bhai aap SSB mai aisa hi nahi recommend hua hai ,mujhe pata hai agar apne kaha hai series complete hogi .I am also a defence aspirant side by side I am pursuing my MCA watching your series also jaab bhi app par doubt ata hai to SSB ko yadd karleta hoon hope you complete this series and thanks for supporting us who isn't able to join your paid courses.Jai Hind
@akshaykumar192 Жыл бұрын
Avi kya kar rahe ho job lagi ?
@idiotstudent-bw4lfАй бұрын
i will complete this course with end goal of getting a mind that solves dsa promblem easily
@krishchoudhary12595 ай бұрын
I feel the priority queue solution is easier. I literally wasted a whole day trying to understand the first approach but couldn't understand completely. But I was able to understand the priority queue solution in the first attempt.
@vishwaksentripathi8250 Жыл бұрын
during explanation, he forgots to point out that, we can't compare and update the key of neighbour which has mst == True
@its_Akash_2 жыл бұрын
Kudos to your content and the consistency 💯
@thesparkyguy93782 жыл бұрын
Consistency??
@Profnegi Жыл бұрын
hum hai bhaiya last tak in every single video. (practice ++)
@_Deepak__Verma8 ай бұрын
29:31 according to the algo we can't change the value whose adjacent node is false in most[v] but babbar said earlier that we have to check only weight if the weight is minimum then key[v] is should be change otherwise we can skip it //check its adjacent nodes for (auto it: adj[u]) { int v=it. first; int w=it.second; if (mst [v] == false && w < key [v] ) { parent [v] = u; key [v] = w; } }
@KrishanKumar-hp5yu2 жыл бұрын
Bhaiya thank u so much Your quality of content is top notch
@sahiltyagi1999 Жыл бұрын
33:00 pahuche hain bhaiyaa, ab to dil dukhane wali baat kr rhe 😢
@vinaysharma66462 жыл бұрын
Ham sb ki bhot hopes h bhaiya aap se so please 🔥🔥
@brajagopalmukherjee15882 жыл бұрын
Bhai already sab khatam ho gaya na ,aur kitna lecture chaiya Thora sa practice karlo
@unboxtheuniverse53362 жыл бұрын
Love you bhaiya ❤️mattt jayaa karo yaar hamko chord kar 🥺🙌 aapke binaa DSA me mazaa nhi aata
@Aman-fz1ew Жыл бұрын
love you bhaiya. for making The Best DSA course . 😘
@chandrabhanbahetwar96382 жыл бұрын
ONE OF THE BEST DSA SERIES IN YOU TUBE LOVE YOU BHAIYA JIO 10000++ SALL
@aashishrangdal96142 жыл бұрын
Finally after 2 weeks bhaiya⚡⚡
@rachit_joshi5 ай бұрын
Thank You So Much BHRATA SHREE !!!!!!!
@gogood05799 күн бұрын
33:01 pahuncha bhaiya++
@VishalGupta-xw2rp2 жыл бұрын
Thankyou soo much Love Babbar bhai for doing soo much for our sake. We are with you till the end. Right now I'm on Lecture 11. Thankyou soo much for everything. It really means alot. 🔥🌠🤩
@akankshapandey97732 жыл бұрын
Thanku so much sir pls ye series complete kr dijiye 🙏🏻🙏🏻
@priyeshvikramsingh85872 жыл бұрын
consistency at peak
@girikgarg12682 жыл бұрын
Time complexity O(V^2*E) honi chahiye...kyunki minimum cost valli vertex ind karne ke baad hum uss node ke sabhi neighbours par jaa rahe hain
@BhaiRayyanKiDuniya2 жыл бұрын
Best part for hard-working
@ShivamKumar-hh9pg2 жыл бұрын
While checking for every adjacent node first we need to check whether mst[that_node]==0. That u didn't include in your explanation. If mst[adj_node] ==1, we do not need to check it in key array.
@ayush18gupta2 жыл бұрын
++
@muzdalfazulfiqar427211 ай бұрын
This was the point at which i am confused i tried to dry run it for 3 to 4 examples and always the wrong output just because i was updating them in key array too , Can u please explain why we do not need to consider them
@satyamkumar90952 жыл бұрын
Aa gayi yaad iss. Course ki late ho rahe ho phir bhi thankyou
@hardikjain-brb11 ай бұрын
28:51 for all the nodes
@harshitagrawal26622 жыл бұрын
32:58 I went till there , and also following this graph series
@PIYUSH-lz1zq2 жыл бұрын
bro ...key[i] < min yeee samaj nahi aaya ...while traversing key arr elements in that are 2 3 6 how it can me smaller than min ??? please tell
@prakashmohaldar90042 жыл бұрын
@@PIYUSH-lz1zq notice min is getting initialized to INT_MAX after every iteration we will get minimum value
@PrakharPandey-no9zs Жыл бұрын
thank you so much bhaiya and lots of love to you
@anuragpandey81652 жыл бұрын
33:00 hum har jagah pohuch jate hai. Keep going brother
@PIYUSH-lz1zq2 жыл бұрын
bro ...key[i] < min yeee samaj nahi aaya ...while traversing key arr elements in that are 2 3 6 how it can me smaller than min ??? please tell
@piyushsingh93202 жыл бұрын
@@PIYUSH-lz1zq see that mini is reset to INT_MAX,on every iteration of first for loop so when you come next time then mini will be reseted to INT_MAX and now we will find new mini by traversing the inner for loop...
@engg.51112 жыл бұрын
Bhaiya back😍😍
@deepikasharma98122 жыл бұрын
Finally u are back.. 🙂
@vinaysharma66462 жыл бұрын
Bhaiya ab is course ko please pehle ki trh continue kr do ...
@tusharbhalothia72052 жыл бұрын
Bhaiya ab bas jaldi se graphs and dp completely complete karwa dijiye please🙏
@vishalkumarshaw92082 жыл бұрын
1 no bhaia...👌👌👌
@Reehan2 жыл бұрын
Aap bhagwan ka kaam kar rhe hai. Keep doing it❤️
@KapilThakur-hx2nx Жыл бұрын
key - distance , mst - visited
@utkarshsingh4052 жыл бұрын
Keep going bhaiya.... You're doing great!.. 👍
@ayushsrivastava15862 жыл бұрын
Bhaiya video k liye bahut mehnat krte h sb log jldi jldi comment krdo
@shivkumar-og4ow2 жыл бұрын
Thanks guru ji... Consistency+++
@MME__MudavathSrinu2 жыл бұрын
Bhaiya the way you explain the problems wow 👍👌
@PIYUSH-lz1zq2 жыл бұрын
bro ...key[i] < min yeee samaj nahi aaya ...while traversing key arr elements in that are 2 3 6 how it can me smaller than min ??? please tell
@harikrushnasuhagiya39252 жыл бұрын
Thank you Bhaiya for your consistency :)
@kshitijraj13202 жыл бұрын
Thanks a lot bhaiya ❤❤❤
@honestad355810 ай бұрын
akhri tak bhi pooch the hai bhaiya aapko nhi pata kei last kei video dekhtey hai bhut sarey log
@awesomepatt6202 жыл бұрын
Thank you bhaiya for thos amazing series. I am also a student of your live Unacademy series. Bhaiya, is there any plan for a System Design course ?
@dEviL_bIsWaJiT2 жыл бұрын
Present bhaiya❤️🔥
@sciencestreamers85092 жыл бұрын
Congratulations in advance for 150 k 🎉🎉🎉🎉🎉
@imalokpandey2 ай бұрын
thankuuu bhaiyaa
@abhaysingh-os3qu Жыл бұрын
just in case anyone is wondering what if the given input is directly adjacency list here goes the code it.. void spanningTree(int V, vector adj[]) { vectorkey(V,INT_MAX); vectormst(V,0); vectorparent(V,-1); key[0]=0; parent[0]=-1; for(int i=0;i
@NYSWorld2 жыл бұрын
32:57 mai pauch gaya
@Shubham-ev1ku Жыл бұрын
Thank you sir , you really made my day.
@AnilPawar-jy9sn Жыл бұрын
Thankyou bhaiya for great explanation but still I feel intuition part of algo is somewhat lacking. Please try to explain the funda before going to dry run and explaining every steps.
@amarpreetkaur60562 жыл бұрын
Thankyou for continuing
@abhinavyadav197011 ай бұрын
mai pahuch gya last tk😅
@oqant04242 жыл бұрын
explained so nicely
@rohit_ojha Жыл бұрын
thanks bhaiya.......... :)
@amanthakur73582 жыл бұрын
back bro ❤️❤️🔥
@AbhishekGupta-cg2vj2 жыл бұрын
Thanku so much bhaiya for such a great series. Consistency++
@iteself_me Жыл бұрын
162 ✅completed 👍Liked 2:53
@onais__2 жыл бұрын
BHAIYA LATE DALO MAGAR QUALITY AUR LENGTH AUR TOTAL TOPICS MEIN COMPRISE MAT KRNA ❤️🔥❤️🔥💫💯
@Robinhoodbhaigandhi2 жыл бұрын
Bhaiya! Nhi ho pa raha h ye. Mujhe lagta h mai coading ke liye bana hi nhi hu. Apke 10 videos dekhe par kuch samajh hi nhi aa raha .isliye dheere dheere intrest bhi kam ho raha h. Aur ab kuch samajh hi nhi aa raha ki kya karu.2021 passout hu par job bhi nhi lag rha .😟
@pragyaverma2105 Жыл бұрын
Thank u ji ❤
@Oroniislam-l6o2 жыл бұрын
Thanks a lot vaia, waiting for a lot💖💖💖
@adityauniyal8632 Жыл бұрын
Line 31 i
@alokranjan31852 жыл бұрын
thanks bhaiya
@bat_man11382 жыл бұрын
Error in the video ...while making dry run and explaining it...u didnt mention while checking every adjacent node first we need to check wether "mst[that_node]==0" And u included that thing directly in code. Though Nyc vid sir . For example sir at 15:20 U are checking key value for "1".but key for 1 should not be checked as mst[1] already true..so no need to look into key array.
@vortexdeo45452 жыл бұрын
Then once key key[v] for that number is updated and then it wont be updated again as its mst[v] would be marked true 🤔In Djikstra, that was not such visited/mst so dist was updated every time for a shorter value
@saadshakeel33484 ай бұрын
Can you explain why is it so, what if we get lesser weight on mst==true node than it had before
@priyanshugupta9192 Жыл бұрын
Done the code by using set instead of priority queue
@amitgupta-or5nm2 жыл бұрын
gud work ....keep it up
@roopchandjangir68622 жыл бұрын
Love u brother 🙂🙂🙂🙂
@fazerugbrug4392 жыл бұрын
excellent
@risha19072 жыл бұрын
Graph series is OP
@PIYUSH-lz1zq2 жыл бұрын
bro ...key[i] < min yeee samaj nahi aaya ...while traversing key arr elements in that are 2 3 6 how it can me smaller than min ??? please tell
@risha19072 жыл бұрын
@@PIYUSH-lz1zqleast key value and uska MST False ho aise index lena hai. Toh woh least value ke liye min se compare karenge
@PIYUSH-lz1zq2 жыл бұрын
@@risha1907 value of each is increasing... like oth index has 0 then first index is 2 then 3rd index is coming to 3 .... how come???
@risha19072 жыл бұрын
@@PIYUSH-lz1zq We'll be updating the values of neighbours in key arr with the given weights. Neighbours of 0 are 1 and 3.