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------------------------------------------------------

КОМЕНТАРІ • 115

  • @trojanhorse8278
    @trojanhorse8278 Рік тому +8

    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.

  • @thepriestofvaranasi
    @thepriestofvaranasi 2 роки тому +4

    This video deserves more attention. You explained the comparators very clearly.

  • @Rakib.56
    @Rakib.56 4 роки тому +6

    Your teaching style is very good... i can easily understand... please make a good playlist of dp for begginner to advance...

  • @aayushgupta6681
    @aayushgupta6681 25 днів тому

    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.

  • @akshitsangwan_
    @akshitsangwan_ 2 роки тому +1

    Best Explanation till now!! Best pedagogical style i have ever seen!!!

  • @M_Sarwar_Tanbeen
    @M_Sarwar_Tanbeen Місяць тому

    Thanks Brother. Your explanation was clear and I have understood everything u explained .

  • @MrChetan54
    @MrChetan54 2 роки тому +1

    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

  • @sunny0287
    @sunny0287 Рік тому

    A great explanation, before watching this video .. this particular topic was always confusing...

  • @abhaygaikwad7228
    @abhaygaikwad7228 4 роки тому +5

    Thanks a lot!!! , I was confused about this topic but after the video all my doubts are cleared

  • @darkexodus6404
    @darkexodus6404 Рік тому

    Very nicely explained. Thanks a ton.

  • @englishlnowledge486
    @englishlnowledge486 2 роки тому

    Yeah lecture bhaut accha he, aur itna accha explanation ise topic par YT par nahi he bo bhi hindi.

  • @harendrakumar9966
    @harendrakumar9966 2 роки тому

    Thank you Sir ! Ek number samjhaya aapne !

  • @rounakjoshi6680
    @rounakjoshi6680 2 роки тому

    Better than many paid course, Thank you.

  • @diptiprakashsinha
    @diptiprakashsinha 3 роки тому +1

    An amazing content. You have cleared my doubts in a very simple way.
    Thanks a lot.
    God bless you.

  • @abhinavkumar7730
    @abhinavkumar7730 3 роки тому

    You have no idea man how much helpful was this video thanks a ton....!!!

  • @Rr-lh2ru
    @Rr-lh2ru Рік тому

    This type of information gives a good knowledge.

  • @siddharth.chandani
    @siddharth.chandani 7 місяців тому

    Wahh ky flow m smjhate ho mja aa gya.. keep it up 👏

  • @sagarg.71
    @sagarg.71 2 роки тому

    very good explanation about max and min heap ....

  • @Aditya-kumar-129
    @Aditya-kumar-129 2 роки тому

    Best content available on youtube. Thanks a lot.

  • @vaibhavgupta973
    @vaibhavgupta973 4 роки тому +1

    You are very Hard working !
    Appreciate it !

  • @fahadabdullah687
    @fahadabdullah687 2 роки тому

    ultra useful video,,.comparators are used very frequently

  • @dhairyachauhan6622
    @dhairyachauhan6622 Рік тому

    best video on comparators

  • @harnoorghatauda648
    @harnoorghatauda648 Рік тому

    Very clear explaination🙌

  • @bruteforceman2311
    @bruteforceman2311 3 роки тому

    bro i have learn something from your video, god bless you

  • @mehakwalia_
    @mehakwalia_ 3 роки тому +1

    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!

  • @mdimranhosen6674
    @mdimranhosen6674 2 роки тому

    That's a great tutorial.

  • @systemforge
    @systemforge 2 роки тому

    Crystal clear 💯

  • @abhisheksharma7056
    @abhisheksharma7056 3 роки тому +1

    very well explained thanks for it..;

  • @soumambanerjee
    @soumambanerjee Рік тому

    awesome explaination

  • @ishitanayak531
    @ishitanayak531 Рік тому

    very useful video genuinely

  • @vishal-sr5et
    @vishal-sr5et 8 місяців тому

    awesome explanation buddy

  • @mayankrawat4685
    @mayankrawat4685 2 роки тому

    you should not leave youtube , you teach really good

  • @shreygupta6479
    @shreygupta6479 3 роки тому

    What an explanation.... Woww... Thank You Bhaiya....

  • @pragneshamadavadi2267
    @pragneshamadavadi2267 2 роки тому

    Best video on comparator 🔥🔥🔥

  • @shresthjain985
    @shresthjain985 3 роки тому

    Great and very simplified explanation!

  • @prajjawalkushwaha4352
    @prajjawalkushwaha4352 2 роки тому

    Appreciate it! Spot On!!

  • @nidhigupta9909
    @nidhigupta9909 3 роки тому

    Great content !!

  • @mayankrawat4685
    @mayankrawat4685 2 роки тому

    amazing video

  • @HimanshuSingh-jq7yg
    @HimanshuSingh-jq7yg 2 роки тому

    Great Video.. Thx.

  • @___vijay___
    @___vijay___ Рік тому +1

    Dhanyawad Bhai

  • @prajaktawankhede6350
    @prajaktawankhede6350 3 роки тому

    very well explaination .......really great sir👍👍

  • @anushrijain3774
    @anushrijain3774 3 роки тому +1

    Appreciate it!! Very helpful

  • @amantiwari8714
    @amantiwari8714 Рік тому

    thankyou earned a subscriber

  • @gorakhkumargupta491
    @gorakhkumargupta491 3 роки тому +1

    Well explained sir ji🙏

  • @tonystarc9567
    @tonystarc9567 3 роки тому

    This was very awesome video... You deserve more subscribers

  • @shashankpandey4387
    @shashankpandey4387 Рік тому

    without creating class ,how would you declare a comparator function? please share the link.....

  • @kartiksaini5619
    @kartiksaini5619 2 роки тому

    thx bhai ,the best video

  • @celestial2091
    @celestial2091 3 роки тому

    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 .

  • @vaibhavsutar2151
    @vaibhavsutar2151 2 роки тому

    Great video on priority queue. But still less view very bad.

  • @shanmuk3462
    @shanmuk3462 3 роки тому

    Y did u use const ?? Wt is it's importance

  • @Rakib.56
    @Rakib.56 4 роки тому +2

    Without making class how doing comparison ... please gimme lesson...or information

    • @The-SoftwareEngineer
      @The-SoftwareEngineer  4 роки тому

      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.

  • @amitsexyyaar
    @amitsexyyaar 3 роки тому

    wonderful explanation

  • @rishabhkumar11
    @rishabhkumar11 Рік тому

    thank you so much 😃

  • @AmitSingh-zg6kb
    @AmitSingh-zg6kb 3 роки тому

    sir this vedio is very wonderful

  • @AshutoshGera
    @AshutoshGera Рік тому

    nice vid :-)

  • @ankit_yadav11
    @ankit_yadav11 Рік тому +1

    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 🙃🙃😊😊

  • @thatsit2397
    @thatsit2397 3 роки тому

    bro u didn't cover comparator for maps

  • @shreyajaiswal7104
    @shreyajaiswal7104 3 роки тому

    Thank you

  • @avinashmv9686894578
    @avinashmv9686894578 4 місяці тому

    Excellent explanation to understand.

  • @vipulsharma6742
    @vipulsharma6742 4 роки тому +2

    brilliant

    • @vipulsharma6742
      @vipulsharma6742 4 роки тому +1

      Can you please make a video on kth garland question?

    • @The-SoftwareEngineer
      @The-SoftwareEngineer  4 роки тому +1

      Sure , i will include this question in my next video.

    • @vipulsharma6742
      @vipulsharma6742 4 роки тому +2

      @@The-SoftwareEngineer and yes ,you are doing great work bro!
      keep doing and keep growing best of luck for your future!

  • @kannupriyarana4971
    @kannupriyarana4971 3 роки тому

    this really helped , thanks a ton :)

  • @ajeetworking
    @ajeetworking 3 роки тому

    thanks for the explanation

  • @theadityasrivastav
    @theadityasrivastav Рік тому

    🔥🔥❤️

  • @anishsinha3272
    @anishsinha3272 2 місяці тому

    I really couldn't get why my comparators in priority queues were not working as intended, now i get it. Thanks

  • @trojanhorse8278
    @trojanhorse8278 Рік тому

    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.

  • @Rahul-kw6zf
    @Rahul-kw6zf 2 місяці тому

    Finally understood comparators!! Thanks a lot!❤

  • @ramchhabra5694
    @ramchhabra5694 3 роки тому +1

    20:08

  • @Rashmi_Yadav_vlogs
    @Rashmi_Yadav_vlogs 3 роки тому

    Amazing videos bro hats off

  • @englishlnowledge486
    @englishlnowledge486 2 роки тому

    Hey bro, I think you already take a placement in Maang &M companies.

  • @satyajeetkumar5267
    @satyajeetkumar5267 Рік тому

    Awesome explanation cleared all my doubts.

  • @sakshamp4488
    @sakshamp4488 2 роки тому

    thankyou so much .before i was struggling with this topic

  • @1713_aniketgupta
    @1713_aniketgupta Рік тому

    this one video explained comarators like nothing

  • @mameabera5852
    @mameabera5852 2 роки тому

    i don't Hindu but i did understand every single thing. Thank you

  • @focusman8801
    @focusman8801 2 роки тому +1

    This is the only video which can tell comparators of priority queue is a really nice way with full concept.Thanks for that

  • @gauravsehrawat2923
    @gauravsehrawat2923 2 роки тому

    thanks brother.......i will be greatful to u

  • @sagarg.71
    @sagarg.71 2 роки тому

    Thank you bhai great content ... Love it ❤❤

  • @sehejwahla5437
    @sehejwahla5437 2 роки тому

    Underrated video bhai. Hope u get more views

  • @shreyasingh1258
    @shreyasingh1258 3 роки тому +1

    veryy confusing thing explained with utmost ease!

  • @AkshatChaudhary-fe3vv
    @AkshatChaudhary-fe3vv 8 місяців тому +1

    best explanation on comparator functions hands down

  • @mdnazirhusain1721
    @mdnazirhusain1721 3 роки тому +1

    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

  • @manasgupta349
    @manasgupta349 4 місяці тому

    great explanation, thanks!

  • @Aditya-rs5dj
    @Aditya-rs5dj 3 роки тому +1

    Most underated channel for coding I should say! Great Content

  • @JIGARSINGTHAKOR-yy6qp
    @JIGARSINGTHAKOR-yy6qp 2 місяці тому

    deserving more subscribers

  • @Anitakumari-hx4tl
    @Anitakumari-hx4tl Рік тому

    Awesome content👍

  • @249_ranajitmukherjee3
    @249_ranajitmukherjee3 3 роки тому +1

    Thanks a lot was looking for this.

  • @RaghavIsTired
    @RaghavIsTired Рік тому

    Thankyou bhai

  • @adityaanand5768
    @adityaanand5768 3 роки тому

    Gawd stuff 😎

  • @mihir72-b9q
    @mihir72-b9q Рік тому

    Great work

  • @ss-md4qn
    @ss-md4qn 2 роки тому

    Superb

  • @threadRunnable
    @threadRunnable Рік тому

    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

  • @GirishJain
    @GirishJain 2 роки тому

    Awesome Video bro understood everything about containers now

  • @satvrii
    @satvrii Рік тому

    ❤❤❤❤❤

  • @garth2356
    @garth2356 Рік тому

    I had been confused about this concept for so long and this video really cleared it up for me! Thanks a lot!

  • @pritishpattnaik4674
    @pritishpattnaik4674 2 роки тому

    U explained the comparator functions in a very easy and efficient way , thanks bhaiya

  • @master_persi
    @master_persi 2 роки тому

    awesome explanation bro....
    cleared all the doubts about comparator.

  • @arijitdey8419
    @arijitdey8419 2 роки тому

    A very informative and much needed video..Keep up the good work..God bless

  • @jatinkumarnpmalcsvph8975
    @jatinkumarnpmalcsvph8975 2 роки тому

    Thanks, was looking for this knowledge. Amazing content.🔥🔥

  • @pranavsharma7479
    @pranavsharma7479 2 роки тому

    very good video for priority queue and comparator , thnks for your efforts

  • @aparnapatra2473
    @aparnapatra2473 2 роки тому

    Very helpful video. Thanks a lot!

  • @AbhishekJain-bv6vv
    @AbhishekJain-bv6vv 2 роки тому

    Never found just detailed explanation anywhere else. Thanks a lot!!