Comparator Function | Custom Priority Queues | Sort in STL | Competitive Programming |
Вставка
- Опубліковано 28 вер 2024
- Hello Guys , this is a tutorial video which contains explanation of Comparator Function ,Priority Queues ,and where Comparator Function are used.
---------------------------------------------------------------------------------------------------------------------------
If you want other tutorial video on any other topic which you find difficult to understand tell me in comment section.
Link of previous video : • CodeForces Round #642 ...
If you like this video then like it and share it. If you are new on this channel subscribe this channel for further videos.
---------------------------------------SHUBH CODING------------------------------------------------------
Summary = > With sort function we pass the function name/functors and with associative data types like set, map ,priority_queue we have to pass the class name and in that class we need to overload the " ( ) " function call operator whose arguments will be passed by reference. One common thing between both is that, in the arguments the first variable in definition will be the element of the smaller index and second will be the element of larger index. In priority queue internally it sorts the input data such that the element with the largest priority comes at the end and hence when we use max heap(default implementation) the container internally will sort the elements in the ascending order and when we want to implement the min heap we need to arrange the elements inside container in the descending order using class definition and operator overloading withing it.
This video deserves more attention. You explained the comparators very clearly.
Your teaching style is very good... i can easily understand... please make a good playlist of dp for begginner to advance...
I was really struggling in understand how the comparator worked in case of priority queue, I was constantly thinking that for MIN Heap I should return ``` a < b ``` in the comparator, until I saw this video that in priority queue highest priority was given to the last element...
Thank You so much, and I really admire the clarity of concepts you have and the how you are able to convey it as well.
Best Explanation till now!! Best pedagogical style i have ever seen!!!
Thanks Brother. Your explanation was clear and I have understood everything u explained .
Awesome explaination for PQ with comparator. Loved the analogy of PQ as an array and then considering the numbers one after another. It made things easy to understand how compare happens
A great explanation, before watching this video .. this particular topic was always confusing...
Thanks a lot!!! , I was confused about this topic but after the video all my doubts are cleared
Very nicely explained. Thanks a ton.
Yeah lecture bhaut accha he, aur itna accha explanation ise topic par YT par nahi he bo bhi hindi.
Thank you Sir ! Ek number samjhaya aapne !
Better than many paid course, Thank you.
An amazing content. You have cleared my doubts in a very simple way.
Thanks a lot.
God bless you.
You have no idea man how much helpful was this video thanks a ton....!!!
This type of information gives a good knowledge.
Wahh ky flow m smjhate ho mja aa gya.. keep it up 👏
very good explanation about max and min heap ....
Best content available on youtube. Thanks a lot.
You are very Hard working !
Appreciate it !
ultra useful video,,.comparators are used very frequently
best video on comparators
Very clear explaination🙌
bro i have learn something from your video, god bless you
Really liked the work you put in. Can you maybe direct my to a good STL tutorial, which is wholesome and as detailed as you are in this one topic? Thanks in advance!
That's a great tutorial.
Crystal clear 💯
very well explained thanks for it..;
awesome explaination
very useful video genuinely
awesome explanation buddy
you should not leave youtube , you teach really good
What an explanation.... Woww... Thank You Bhaiya....
Best video on comparator 🔥🔥🔥
Great and very simplified explanation!
Appreciate it! Spot On!!
Great content !!
amazing video
Great Video.. Thx.
Dhanyawad Bhai
very well explaination .......really great sir👍👍
Appreciate it!! Very helpful
thankyou earned a subscriber
Well explained sir ji🙏
This was very awesome video... You deserve more subscribers
without creating class ,how would you declare a comparator function? please share the link.....
thx bhai ,the best video
great video bro!! Also can you share some links where we can learn such concepts because not many resources are available right now due to covid , it will be very helpful.
this is the only video i found which cleared my concept .
Great video on priority queue. But still less view very bad.
Y did u use const ?? Wt is it's importance
Without making class how doing comparison ... please gimme lesson...or information
In some STL function (sort,transform,etc) you can pass function name as a parameter.There is no need to create class.But in some containers of STL you have to create class ,there you cannot pass function name as a parameter.
wonderful explanation
thank you so much 😃
sir this vedio is very wonderful
nice vid :-)
sir aapka hath jorkr sukriya ada kar rha hun , aapki wajah se aaaj maine apna dukh dard dur ho gya i m feeling so good , heaps ek question hai merge k sorted array isme ye priority queue ka concept use hua hai is wajah se mujhe samjh hi nhi aa rha tha but now i m feeling so confident . dil ki gehraiyon se apka sukriya 🙃🙃😊😊
bro u didn't cover comparator for maps
Thank you
Excellent explanation to understand.
brilliant
Can you please make a video on kth garland question?
Sure , i will include this question in my next video.
@@The-SoftwareEngineer and yes ,you are doing great work bro!
keep doing and keep growing best of luck for your future!
this really helped , thanks a ton :)
thanks for the explanation
🔥🔥❤️
I really couldn't get why my comparators in priority queues were not working as intended, now i get it. Thanks
Bhaiya aapka bahot badiya hai explanation, kya aap koi book suggest kar shakte hai to learn stl and functors like concepts in depth. From where did you prepare them please share.
Finally understood comparators!! Thanks a lot!❤
20:08
Amazing videos bro hats off
Hey bro, I think you already take a placement in Maang &M companies.
Awesome explanation cleared all my doubts.
thankyou so much .before i was struggling with this topic
this one video explained comarators like nothing
i don't Hindu but i did understand every single thing. Thank you
This is the only video which can tell comparators of priority queue is a really nice way with full concept.Thanks for that
thanks brother.......i will be greatful to u
Thank you bhai great content ... Love it ❤❤
Underrated video bhai. Hope u get more views
veryy confusing thing explained with utmost ease!
best explanation on comparator functions hands down
29:40 Bhaiya priority queue m numbers sorted nhi hoti n bs highest priority wali top pe hoti h kuyki max heap m to asa hi hota h
great explanation, thanks!
Most underated channel for coding I should say! Great Content
deserving more subscribers
Awesome content👍
Thanks a lot was looking for this.
Thankyou bhai
Gawd stuff 😎
Great work
Superb
Literally sir..... You explained it very well,,, I have gone through multiple videos for sorting but no one gave clear view on this.....but now I am full confident on sort compare function
Awesome Video bro understood everything about containers now
❤❤❤❤❤
I had been confused about this concept for so long and this video really cleared it up for me! Thanks a lot!
U explained the comparator functions in a very easy and efficient way , thanks bhaiya
awesome explanation bro....
cleared all the doubts about comparator.
A very informative and much needed video..Keep up the good work..God bless
Thanks, was looking for this knowledge. Amazing content.🔥🔥
very good video for priority queue and comparator , thnks for your efforts
Very helpful video. Thanks a lot!
Never found just detailed explanation anywhere else. Thanks a lot!!