Here we are looping from 1 to n and calling make(i) ; but we are not making 0 , which is also a part of the graph !!! here this code works because all the array is initialized with 0 , and the parent[0] = 0 , initially ... so this is why this code works without having to use make(0) ... Just pointing this out if anyone had this doubt ( like I had ! )
++ @dr_davinci we have to also intilaise the size to be 1 right?, but I guess it will only increase the time complexity therefore the the answer si coming as correct still
Finally completed all the videos in your competitive programming course. This is really the best on UA-cam. Thanks a lot for helping us. You deserve all appreciations. 💙💙💙💙💙
one of the best graph playlist. i watch lots of youtube video from other channel,but no one teaches better than you. thanks you bhaiya. all hearts in one comment💛💚💙
Bhaiya, Can we just find the MST (to get minimum wiring cost) and then add the minimum of all the costs (to put a power house). Instead of adding one extra node in the tree.
Instead of storing the edges in a vector, I stored them in set. I then iterated over the set to form the MST. For some reason, using a set is causing a TLE error on testcase-7. I believe both methods have same time complexity. Any reason why using a set is slower?
n = 2000 so total TC of the solution will be using set which performs operations in log n --> O(n^2*logn(dsu ki tc)*logn(due to set)) gives total of O(around 2*2*1e6*10*10 = 4*1e8) which leads to TLE but without set tc will be only -> O(4*1e7 which is acceptable in 1s) by removing logn factor due to set......( log (n) = log(2000) ~ 10) I hope your doubt will be cleared
Here we are looping from 1 to n and calling make(i) ;
but we are not making 0 , which is also a part of the graph !!!
here this code works because all the array is initialized with 0 , and the parent[0] = 0 , initially ... so this is why this code works without having to use make(0) ...
Just pointing this out if anyone had this doubt ( like I had ! )
but in code we also initialize size[v]=1,it has not been called in case of zero.that will increase timecomplexity relatively.right?
please share your code , i am facing some problem
++ @dr_davinci we have to also intilaise the size to be 1 right?, but I guess it will only increase the time complexity therefore the the answer si coming as correct still
Can you please explain this?
What about size[v]=1 in case of 0th node.
For me it is like, ke jis din luv ki video dekh li wo din productive ho gaya👌🏻.
Every video is so informational💙
I always feared graph/tree question but after completing this series, I am more confident in tackling graph questions.
Loved the whole series 💛
Finally completed all the videos in your competitive programming course. This is really the best on UA-cam. Thanks a lot for helping us. You deserve all appreciations.
💙💙💙💙💙
How was your journey brother? Can you please give us a review of this whole CP course?
your videos are something diff from others and you are best teacher 😇
this intuition blew my mind! amazing!!
Congratulations.... 100k Completed....
one of the best graph playlist.
i watch lots of youtube video from other channel,but no one teaches better than you. thanks you bhaiya.
all hearts in one comment💛💚💙
10:00 that explanation technique🙏🙏👌👌
Waiting for DP🤞
Aagaya hai bro
which shortcut keys you use for proper indentation of code ? In sublime text?
Love this series 💙💙
please keep on making these videos.. These are awesome.
this problem is beautiful !
Wow, Simply Amazing !! Kudos !!
Thank you bhaiya so much . Your all videos were amazing . Got to learn so much. Dua karo ki mera abh triology me ho jaye💛💛💛💛 ❤❤❤❤
*Even I'm not gay but still I love you bro. You are amazing. Already following from beginning. From MANIT Bhopal* 😀
I could not think of the solution, :( nice explanation tho, easily understood , when will I get to this level, agghhhh.
such an interesting question!
Bhaiya, Can we just find the MST (to get minimum wiring cost) and then add the minimum of all the costs (to put a power house). Instead of adding one extra node in the tree.
no, it is possible the two installing two power house in 2 different villages could cost less then connecting those villages with connections
💙.U nailed it bro. maza aagaya
thanks for the awesome course 💙
Bhaiya directed graph par bhi ek video banao please!!! Traversal, cycle detection etc
this channel is gold
Great Approach
💙💙💙💙 Awesome video as always.
sir , why did you make just n node using make() function, even though you have assumed a additional node 0?
Hello
He must have made it with 0 node and might have forgot to include in error correction
Great bhai♥
Luv u luv bhaiya 💗
Tnx bhaiya for the ❤️
kya solution he sir ak no.
Amazing trick🤣. after knowing it laughing on myself.
Nice q and congrats for 100k. When are you going to start dp
your contents are just awesome ❤ Love from West Bengal vaiya ❤
Nice question
Congrats for 100K
Instead of storing the edges in a vector, I stored them in set. I then iterated over the set to form the MST. For some reason, using a set is causing a TLE error on testcase-7. I believe both methods have same time complexity. Any reason why using a set is slower?
n = 2000 so total TC of the solution will be using set which performs operations in log n --> O(n^2*logn(dsu ki tc)*logn(due to set)) gives total of O(around 2*2*1e6*10*10 = 4*1e8) which leads to TLE but without set tc will be only -> O(4*1e7 which is acceptable in 1s) by removing logn factor due to set......( log (n) = log(2000) ~ 10)
I hope your doubt will be cleared
awesome video 🔥🔥🔥
Brilliancy!
algouniversity ke intern ke interview me merese ye question pucha tha isi ka variation mai nhi bana paya tha yar
Congratulations bhai 1L
Thanks Luv
vroh making me proh
How many days Will it take to complete this course?
bhaiya you run the loop from 1 to n when you called the make function and still the code works how? shouldn't it be from 0 to n ??
💙💙💙100 th comment for you
Good question🙌 with crystal clear explanation 💙
💛Thank You💛
Woww
Bhaiya please graphs pr or bhi questions or uske intuitions discuss krna. This topic really gets on my nerves.
after knowing it's MST problem then this will take 5 min to think of this solution;
Welcome in comming back💔💔❣️
Op bhai
Demn gud
blue heart
Nice
Bhaiya 930 questions aur 🙂
good
🔥🔥
💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛💛
ye medium level ka hai ? Phir hard kaisa hoga ? 😌😑
It cf 1900 rated question which is medium only, cf 2000+ rated questions are hard imo
💛💛💛💛💛💛💛
💗
💙💙
💙💙💙💙💙💙💙💙💙💙💙💙💙💙
💙💙💙💙
💙
💙💙💙💙💙💙
💙💙💙💙💙💜💜💜💜🖤🖤
💙💙💙💙
💙💙
💙
💛
💛💛💛💛
💙
💛
💙
💛
💙
💙💙
💙💙
💙
💙💙
💙
💚💚
💙💙
💙
💙
💙
💙
💙
💙
💙
💙💙💙
💙
💙
💙
💙💙💙
💙
💙