Comparator Function in depth Tutorial using C++ Sort | CP Course | EP 34

Поділитися
Вставка
  • Опубліковано 28 вер 2024

КОМЕНТАРІ • 263

  • @vaibhavjaiswal7811
    @vaibhavjaiswal7811 3 роки тому +191

    This was truly so well explained. Just one request from my side, please don't discontinue this series ever.

    • @himanshurajpal7842
      @himanshurajpal7842 Рік тому +3

      Literally ❤, please don't discontinue this !
      We love your content, we love you luv 💞,

  • @reverbism
    @reverbism 3 роки тому +40

    Am a Software Engineering student i watch your video to clear my thought amd your videos help me a lot. Your video are best for beginners i can fell your efforts God Give You Success

  • @sumeetbhujang2756
    @sumeetbhujang2756 3 роки тому +20

    This is the best ever explanation of the sort comparators I have ever seen.. Bhai you are generating truely valueable content. Thanks 🙏

  • @saranggakhar7932
    @saranggakhar7932 2 роки тому +5

    i was confused about this method but after watching your video I am feeling confident. thank you sir 🙌🙌

  • @suparnobhattacharya6345
    @suparnobhattacharya6345 2 роки тому +2

    This guy is underrated. Thanks a ton, mate. This really helped a lot

  • @AnandKumar-qj2iy
    @AnandKumar-qj2iy Рік тому +1

    Before few months I could not able to understand this video but today I was able to understand this video completely!!! Thank You

  • @Ak-kc7qp
    @Ak-kc7qp 3 роки тому +8

    for those searching the ans of the link's ques by comparator fnctn
    #include
    using namespace std;
    bool cmp(pair a, pair b)
    {
    if (a.first != b.first)
    return (b.firsta.second);
    }
    int main()
    {
    int n;
    cin >> n;
    vector arr(n);
    for (int i = 0; i < n; i++)
    {
    cin >> arr[i].second >> arr[i].first;
    }
    sort(arr.begin(), arr.end(), cmp);
    for (int i = 0; i < n; i++)
    {
    cout

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

      Bro plz vo latter count vale ka solution bhejo na I am beginner so plz give answer related to topics which coverd till this video plz bro🙏

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

      @@crazybanna228 #include
      using namespace std;
      int main()
      {
      map m;
      string s;
      cin>>s;
      int count = 0;
      int index;
      char find;
      for(int i = 0; icount){count = it.second ;find = it.first;}
      }
      cout

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

    Bro I must say your way of teaching this complex things helps us to learn in simpler way

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

    This is one of your best videos in competitive programming course
    😀😀

  • @namangupta9582
    @namangupta9582 5 місяців тому

    Trust me bro.. You are "GOD" for me. My doubts for comparator function is solved for whole life!!

  • @adityasankhla1433
    @adityasankhla1433 3 місяці тому

    This is the good shit man. Clarified comparators like nuthin else. Thanks!

  • @rahulgovindkumar3105
    @rahulgovindkumar3105 3 роки тому +2

    The bloopers are funny 😂😂especially macchar wala!!! But jokes apart video bahut helpful hai bro thanks 💯💯❤

  • @pendyalaabhishek6273
    @pendyalaabhishek6273 3 роки тому +4

    wow it helped me .now i can sort any sequence any way i want .

  • @sanskaradv2784
    @sanskaradv2784 3 роки тому +4

    I was really confused about this comparison func for almost 1 month but this video is crystal clear... Thanks bhaiya 😍

  • @theuntoldtree
    @theuntoldtree 3 роки тому +2

    yee bhai,subeh se dimag khrab tha ye question ko leke
    tq;
    tumhara channel aur subscribers maangta hai bidu XD

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

    are waaah ajj finally comparators samaj aa hi gaye
    TRICK:-
    just return what u want

  • @shubamdadhwal3497
    @shubamdadhwal3497 3 роки тому +3

    loved the way you explained bro! it compelled me to subscribe right away !

  • @HarshalKotkar-yy9vk
    @HarshalKotkar-yy9vk 2 місяці тому

    Best ever explanation of sort function 👍 thanks

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

    maza aa gaya bhai tumne pura concept clear kar diya love U bhai

  • @sleepypanda7172
    @sleepypanda7172 3 роки тому +18

    thanks you! this was exactly what I was looking for.
    Thank you so much! you cleared my concept very well! your way of explaining is damn good.
    (don't know if it is right to say or not:- but you are cute :P)

    • @iamluv
      @iamluv  3 роки тому +4

      Hahaha Thanks xD

    • @AnoNymOuS-mg9oj
      @AnoNymOuS-mg9oj 2 роки тому

      @@iamluv comments boht sahi pkde reply Krne ke liye 😂😂 # men will be men

    • @AnoNymOuS-mg9oj
      @AnoNymOuS-mg9oj 2 роки тому

      @@iamluv by the way ur videos helps me lot in in my journey ek doubt bhi tha cp vs web/ andr dev kucch btaa skte ho konsa path Sahi hai tier 3 college se hun

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

    Real teacher feel hi aa jata hai😊

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

    Great explanation, my first video of your channel

  • @hemrajthakur374
    @hemrajthakur374 3 роки тому +3

    Thank you brother... Your videos always helps me❤

  • @suryanshkambojy
    @suryanshkambojy 3 місяці тому

    Finally someone explained it! Thanks :D

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

    fascinating video Luv. I killed that thumbs up on your video. Continue to keep up the good work.

  • @rajsinghrajpoot8945
    @rajsinghrajpoot8945 3 роки тому +2

    In one of your video you talked about your interview experiences in which you talked about a problem wifi router can you make a video on that so we can know how you have approached the problem during interview.

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

      i dont remember my interview experience honestly if you are looking for my approach at that time.. it was almost 1 and half years ago if you want solution to that problem you can check link of that problem in desc of that video and you can see editorial on codeforces then.

  • @Sarkar.editsz
    @Sarkar.editsz 2 роки тому +1

    Masterji tussi great ho ❤️❤️🙏🙏

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

    Bhai best ever video on comparator

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

    Thank you Bhaiya 🙏🙏🙏♥️😊😊

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

    Yeah .. using comparator, that question becomes very easy. Nice !

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

      Bro plz vo latter count vale ka solution bhejo na I am beginner so plz give answer related to topics which coverd till this video plz bro🙏

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

    This guy saved my day.

  • @reverbism
    @reverbism 3 роки тому +4

    Lov U love bhai ♥️

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

    Simple sharp to the point so easy to understand.Thank you bhaiya

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

    Your canines are really sharp!!!!!

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

    the links given in the description for practice the problems are not working.

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

    i dont know why you dont have much subscribers but your videos are awesome

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

    great teaching skills

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

    excellent work. you are doing a lot of help to community. thank you very much.

  • @sandeepyadav-nu5ih
    @sandeepyadav-nu5ih 7 місяців тому

    mjaaa aa gya bhai kya cheez banayi hai.❤❤❤❤❤❤❤❤❤❤❤❤

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

    That was truely awesome.Just to the point .

  • @maheshsain4010
    @maheshsain4010 10 місяців тому

    Uhh r giving yr 100% & that's results uhh also know ❤

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

    Thank you sir ❤️

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

    very nicely explained!! loving the course

  • @Nitro-kx7ok
    @Nitro-kx7ok Рік тому

    UNDERSTOOD SIR❤🙏🙇‍♂

  • @Profnegi
    @Profnegi 7 місяців тому

    i'm stuck on a problem and i want to do the same thing...with vector of pairs..thx man

  • @046_krishnarajchouhan9
    @046_krishnarajchouhan9 3 роки тому

    bhott shi chij bata diye guru maja aagya thank youu sare dought clear kr diye broo

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

    so nicely explained.. thanx bro

  • @Ramu9119
    @Ramu9119 9 місяців тому

    excellent explanation brother

  • @coefficient1359
    @coefficient1359 3 роки тому +3

    OP🔥

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

    So Nice Explanation

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

    Excellent videos, You are working very hard in making such videos

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

    Superb video . Best competitive programming concepts

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

    you are the best.......mausm.

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

    Nice explanation !

  • @minhazjisun759
    @minhazjisun759 3 роки тому +12

    You are an incredible brother!
    your video is so helpful.
    when you gonna start DP or GRAPH part??

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

    I love the bloopers, thank you

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

    you are a genius

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

    1ch number bhava!!

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

    great explanation bro

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

    Very helpful luv !!

  • @035asadali8
    @035asadali8 2 роки тому

    brother u not use constant in comparator and i use ur comparator without const and my problem c got wrong in system testing it gives runtime error in one case ,after using constant it got accepted

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

    best explanation

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

    May god bless you

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

    Thank u

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

    Very much helpful

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

    The explanation was so good.

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

    how did u add input.in and output.in file without freopen? Pls I want to know

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

    thank you very much sir

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

    Bohut shukriya bhaiya

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

    very well explained❤️👍

  • @Team-ys8mg
    @Team-ys8mg 2 роки тому

    Bhaiya sliding window ki video banao..

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

    sir the links 2,3 of practice problems in description are not working(404 page not found); can u please update them..

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

      Bro plz vo latter count vale ka solution bhejo na I am beginner so plz give answer related to topics which coverd till this video plz bro🙏

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

    Kudos bro.

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

    Questions ki second aur third link kam nahi kar rahi , thanks for the video anyways

  • @Somendra_Kharola
    @Somendra_Kharola 9 місяців тому

    Thank you!

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

    Thanks, this was a great explanation!

  • @DHIRAJKUMAR-iw3dj
    @DHIRAJKUMAR-iw3dj 2 роки тому

    same code vs code pe shi putput de rha hai lekin hackerearth pe wrong solution deta hai kyon

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

    High value content. 💜

  • @sachinnarute7914
    @sachinnarute7914 8 місяців тому

    < means descending order sirji

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

    thank you very much

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

    Thank you Luv

  • @Abhishek-sz8wg
    @Abhishek-sz8wg Місяць тому

    thank u cp master 🪔

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

    return what you want to get...NICE

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

    thank you so much bhaiiya

  • @mr.anonymous3871
    @mr.anonymous3871 Рік тому

    Thank you

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

    why dont we need to pass arguments in comparator

  • @s.aravindh6227
    @s.aravindh6227 3 роки тому +1

    Nice video bro 👍👍

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

    Bhai ye comparator fun aapne likha hai sort function ke parameter me lekin comparator func ka naam likha hai bas bracket nahi lagaya???

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

      function call nhi krna hai, function pass krna hai

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

      @@iamluv achcha bhaiya 🙏 thanks
      For instant reply
      Kaafi achcha course hai ye meri kaafi improvement ho rahi hai aur kai cheeze to c++ basic me bhi pehli baar suni
      Thanks

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

    but how can we use map m; since marks can be duplicate

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

    @LUV ,can you please explain when to use this comparator function using overloading ``` struct compare
    {
    bool operator()(pair a,pair b)
    {
    if(a.second

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

    great work bro

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

    well explained. thanks sir

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

    Is it necessary to have comparators defined as static if defined inside a class?

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

    Thanks!!

  • @RudraSingh-pb5ls
    @RudraSingh-pb5ls 3 роки тому

    Where is the link of video of ques that you did with nesting and maps

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

    Can we use inbuilt sort function in set or multiset? I tried but it was showing error.

  • @AbhishekKumar-kk6qs
    @AbhishekKumar-kk6qs 3 роки тому

    Great explanation.

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

    Thanks man

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

    thanks

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

    great explaination😄