Sorting Algorithm | Counting Sort - step by step guide

Поделиться
HTML-код
  • Опубликовано: 4 окт 2024
  • In this video we will learn about counting sort. It is an algorithm in which we don't compare two elements while sorting.
    Counting Sort code link
    www.dyclassroo...
    Algorithm Playlist
    • Algorithm
    Data Structure Playlist
    • Data Structures
    if you find my videos interesting and enjoy watching them then please give a thumbs up, share and subscribe my channel and comment.
    click the following link to subscribe my channel
    www.youtube.co...
    thanks for watching
    see you in the next video
    stay happy and keep smiling :-)

Комментарии • 164

  • @debopamseal1072
    @debopamseal1072 8 лет назад +88

    Straight to the point, no bullshit. Its amazing how a teacher who has no direct involvement not even sound can accomplish something a teacher teaching directly in class, with every facility available cannot..! Thanks

  • @sipungora
    @sipungora 8 лет назад +25

    Only on example 2 I understood why we should reduce the sumCount index. It needs in duplicate case.

  • @subhashvadlamani9412
    @subhashvadlamani9412 5 лет назад +2

    Sometimes words come in the way of understanding. I realized this fact after watching this video. Thanks a ton!

  • @qR7pK9sJ2t
    @qR7pK9sJ2t 5 лет назад +1

    Mindichhh blowing video

  • @absi1155
    @absi1155 8 лет назад +7

    And you saved my life. Thank you so much Sir !!! Appreciate it

  • @yuliiakosenko3028
    @yuliiakosenko3028 Год назад

    Great video! Finally, I understand it!

  • @husnainajmal3346
    @husnainajmal3346 7 лет назад +1

    best in the business...very well explained....thanks man

  • @shababali1779
    @shababali1779 2 года назад

    Thank you Sir its so easy to understand .God bless you

  • @vaibhaviprajapati1375
    @vaibhaviprajapati1375 8 лет назад +6

    Great explanation! Now I'm able to memorise this sorting process much more easier. :-)

  • @shenmingteo7848
    @shenmingteo7848 5 лет назад

    Such a great guidance.

  • @tarunmungurah1109
    @tarunmungurah1109 3 года назад

    best explanation ever!!

  • @jyl4990
    @jyl4990 4 года назад

    This is the video I am looking for! Teach with patience and a bit of detail!

  • @OzanATA
    @OzanATA 8 лет назад +1

    great video, i took a paper and a pencil as you said ant in less than 5 mins i learned how to count sort. gj sir

  • @RajeevKumar-bh3pq
    @RajeevKumar-bh3pq 5 лет назад

    Are Bhai wah😂😂 Mst teacher shock ho jaega 😂😂

  • @warlock9667
    @warlock9667 7 лет назад +4

    Fantastic Explanation...thank u so much sir

  • @prernagarg871
    @prernagarg871 5 лет назад +1

    Awesome sir thnkee

  • @ramadagi
    @ramadagi 8 лет назад

    i was nervous about this concept. Now you've made me confident.

  • @10uRization
    @10uRization 5 лет назад

    Well you don't even have sound. How tf you've achieved to teach me and us..?
    You, you are a real teacher.

  • @balaganesh3440
    @balaganesh3440 3 года назад

    The slowest 11minutes 40 seconds of my life......btw the explanation was clear and easy to understand with the slow pace.....good one!

  • @galaxian_hitchhiker
    @galaxian_hitchhiker 8 лет назад +9

    to make it stable start from the last element when filling 'sorted input' array..

  • @dhruvsb3161
    @dhruvsb3161 8 лет назад +28

    This is not a stable method. In example 2, the relative order of 4 changes which is not supposed to because counting sort is stable sort.
    For the stable output start from the last number instead of first (in order 4,2,8,10,9,4) at 9:06

    • @mesarvagya777
      @mesarvagya777 7 лет назад +5

      Yes to make Counting sort stable, one needs to read numbers from right to left.

    • @spandanakrishnan1362
      @spandanakrishnan1362 6 лет назад

      Why?

    • @MN-sc9qs
      @MN-sc9qs 6 лет назад

      Correction: (in order 4,2,8,10,4,9)

    • @debabratatah4887
      @debabratatah4887 6 лет назад

      bro it is stable bcz look carefully value 4 in position 2 in input(unsorted) array appears before value 4 in position 6 input(unsorted). so in sorted array the 2nd position 4 comes before 6th position 4. thats the stability

    • @patrick_jane
      @patrick_jane 6 лет назад

      I hate to say it but you're wrong. Look carefully what position first 4 comes to and what second. It's 3 and 2. So it's not stable

  • @Aqeelnk
    @Aqeelnk 6 лет назад

    Thanks, I understood from your video what I couldn't understood from my prof.

  • @maxwellperez5314
    @maxwellperez5314 7 лет назад

    omg... I think that was more dificult but not is very easy... thanks U!

  • @bogdannikitchuk3878
    @bogdannikitchuk3878 6 лет назад

    Thank you very much for code!

  • @remonzoomagdy1351
    @remonzoomagdy1351 2 года назад

    Masterpiece ,
    Thanks man

  • @mlbbhyper7619
    @mlbbhyper7619 8 лет назад

    Fully understand.... Thank you

  • @ganbaatarbadarch7301
    @ganbaatarbadarch7301 5 лет назад +12

    How did you let me understand this easy?? I watched like 2 or 3 videos and read the explanation but didn't get an idea but you made it looks easy thanks a lot.

    • @Netugi
      @Netugi 4 года назад

      I think at least part of it is the pacing. Another video I watched was 2 minutes and rushed by it way too quickly for me to really get what was going on. With the pacing of this, I have time to process what's actually going on.

  • @abemelekdaniel8913
    @abemelekdaniel8913 Год назад

    i cann't say word except talented !

  • @vikramadity1
    @vikramadity1 7 лет назад +1

    Thank you very much Yusuf sir for this simple and to the point video , thank you very much and keep it up.

  • @PlayfulJoyful
    @PlayfulJoyful 5 лет назад

    You are a magnificent teacher. Thank you!!!

  • @laladawood8463
    @laladawood8463 7 лет назад +1

    I love the way ur teaching style its amazing and now I understand the technique that you told ...

  • @priyasaini6263
    @priyasaini6263 2 года назад

    Very very gud explain .

  • @asinggsingh
    @asinggsingh 8 лет назад +8

    Really nice explanation in easy way 👍

  • @OliGeeInDaHouse
    @OliGeeInDaHouse 8 лет назад

    Thanks - no voice was appreciated! Simple and easy to understand.

    • @yusufshakeel
      @yusufshakeel  8 лет назад

      +Oliver Goldstein thanks for watching.
      here is the algorithm playlist. you may find it interesting.
      ruclips.net/p/PLG6ePePp5vvYVEjRanyndt7ZSqTzillom
      thanks for commenting :-)

    • @muhammadbasit1959
      @muhammadbasit1959 8 лет назад

      great yrrr wowww

  • @JW-pq1ml
    @JW-pq1ml 7 лет назад +1

    Great video! Just what I needed to understand what's going on with this algorithm. Liked!

  • @koushikmediga8397
    @koushikmediga8397 8 лет назад +1

    nice interface, simple explanation ,straight to the point ...atlast superbbb

  • @rahulkumarpatra4206
    @rahulkumarpatra4206 6 лет назад

    He is doing justice to deaf computer enthusiast

  • @abhishekkatiyar7666
    @abhishekkatiyar7666 7 лет назад +3

    You are doing great job

  • @ZMZHANG-rd1ir
    @ZMZHANG-rd1ir 6 лет назад

    thank you! it is very cool to understand the counting sort algorithm.

  • @ChindoEnyidah
    @ChindoEnyidah 8 лет назад +2

    Very helpful, thanks.

  • @ShakibAlRaji
    @ShakibAlRaji 6 лет назад

    well explained.

  • @kyriakoslatsoynhs5907
    @kyriakoslatsoynhs5907 Год назад

    Thank you very much , sir.

  • @u4awesome
    @u4awesome 7 лет назад

    best 10 minutes of my life.

  • @devashishadhikari1302
    @devashishadhikari1302 7 лет назад

    thts a grt video bro

  • @jimninikas6394
    @jimninikas6394 8 лет назад +4

    Simple steps,nice explanation!!!

    • @yusufshakeel
      @yusufshakeel  8 лет назад +2

      thanks for watching :-)

    • @Infinitera1n
      @Infinitera1n 8 лет назад +2

      Amazing tutorial! really easy to understand

  • @user-tm1ix7xi1n
    @user-tm1ix7xi1n 4 года назад

    Excellent

  • @naimmazmi
    @naimmazmi 8 лет назад +1

    This helps a lot... Thanks

  • @shriharikulkarni07
    @shriharikulkarni07 6 лет назад +1

    you are amazing....thanks a ton.

  • @pravinaparmar4065
    @pravinaparmar4065 5 лет назад

    wonderful explanation, thanks.

  • @techwithbube
    @techwithbube 5 лет назад

    In Nigeria we will say this guy sabi. Meaning he knows. Guy you sabi thanks a lot

  • @piyushmathur8277
    @piyushmathur8277 7 лет назад +1

    you explain so good...

  • @alevs26
    @alevs26 8 лет назад

    Excellent explanation! Thanks.

    • @yusufshakeel
      @yusufshakeel  8 лет назад

      +Alessandra Santos thanks for watching :-)

  • @sandeepkaindal1501
    @sandeepkaindal1501 6 лет назад

    Nice video

  • @shubhangisrivastava5859
    @shubhangisrivastava5859 5 лет назад

    Best teacher ever💕

  • @andreidan9276
    @andreidan9276 8 лет назад

    Nice work ! I finally understood this for my exam, thank you !

  • @ruyangguo6495
    @ruyangguo6495 7 лет назад +1

    Great video, thank you :D

  • @VFXCommander
    @VFXCommander 7 лет назад +3

    You, sir, are good!

  • @LocalAI123
    @LocalAI123 9 лет назад +1

    Thank you very much!!!!!!

    • @yusufshakeel
      @yusufshakeel  8 лет назад

      +dy l thanks for commenting and watching my video :-)

  • @vivekkapoor7195
    @vivekkapoor7195 7 лет назад +1

    amazing videos bro tysm :)

  • @thehobbyshop5154
    @thehobbyshop5154 5 лет назад

    great job! keep producing, your are benefiting the world.(Y)

  • @kennethdeoliveira
    @kennethdeoliveira 5 лет назад

    Fantastic Explanation ❤

  • @roh_95
    @roh_95 4 года назад

    Tnx man!

  • @nqobaninhlengethwa8363
    @nqobaninhlengethwa8363 5 лет назад

    This is good stuff. Thank you.

  • @任安明
    @任安明 7 лет назад +1

    thank you so much!

  • @BADKALOS
    @BADKALOS 7 лет назад

    Thank you sir! Indians are the best in software & electrical engineering. Almost every toturial i find on youtube is indian.

  • @spandanakrishnan1362
    @spandanakrishnan1362 6 лет назад

    You are demi-god. I was reading Algorithms unlocked and CLRS book and I was scratching my head. I wish those books had such examples. Btw, Why are we decrementing when we have non-repeating input?

  • @AmbiguousAbhi
    @AmbiguousAbhi 8 лет назад

    awesome explaination sir.
    thank you helped alot

    • @yusufshakeel
      @yusufshakeel  8 лет назад

      +Abhijeet Joshi thanks for watching :-)

  • @stefandudasko8984
    @stefandudasko8984 5 лет назад

    Just to clear this - it is unstable in this example, right? If we would have taken digits from the right (9:08) then it would be stable?

  • @kawtheralateeq8264
    @kawtheralateeq8264 7 лет назад +1

    thank you so much !

  • @dilsingh5796
    @dilsingh5796 7 лет назад +1

    ty bro ...solved.

  • @vaishnaviganseh2884
    @vaishnaviganseh2884 7 лет назад

    amazing job!

  • @God3aterGaming
    @God3aterGaming 5 лет назад

    thx mate

  • @rasal-t1822
    @rasal-t1822 8 лет назад +3

    Well explained by simple examples!
    Also would be nice to get some algorithm specific properties and time & space complexity

  • @DeepakKumar-ox5ti
    @DeepakKumar-ox5ti 7 лет назад +1

    Superb explanation

  • @hafizawaissadaqat7113
    @hafizawaissadaqat7113 5 лет назад +1

    Thanks Sir This video quite helpful for me May Allah bless you with ease and comfort in your life (Ameen)
    Stay blessed sir
    but a request there if you done this sorting according to algorithm means with each line you demonstrate the work of algorithm it much more valuable if you done it for me its an honor for me sir

  • @mdtanvirhasan4952
    @mdtanvirhasan4952 8 лет назад

    gd job...

  • @tehreemshah5833
    @tehreemshah5833 6 лет назад

    good..

  • @vaishnaviganseh2884
    @vaishnaviganseh2884 7 лет назад +1

    counting sort is a stable sorting algorithm. in the second example the output is not stable

  • @ahmadabuyousef9088
    @ahmadabuyousef9088 8 лет назад

    very very very very very very very very nice

  • @MagicMisha
    @MagicMisha 8 лет назад +1

    Very nice! I think that if you would add time complexity of algorithm and pseudo code of algorithm it would be ideal ! good job

    • @yusufshakeel
      @yusufshakeel  8 лет назад

      +Михаил Зиновьев thanks for watching :-)

    • @deedewald1707
      @deedewald1707 3 года назад +1

      This is stable at count & get left to right O(n) sorted values

  • @vishaliammu
    @vishaliammu 7 лет назад

    for the given array 10,7,12,4,9,13 since minimum is 4 and maximum is 13 , we can find these values and mark them as 1 which ever element is available, what if the array contains negative values, how do you create array lets say minimum is -4 and maximum is 13 , how do we create array with indices from -4 to 13 ?

  • @Adnan-hw2wt
    @Adnan-hw2wt 5 лет назад

    amazing brother.. keep it up!

  • @dalambert2105
    @dalambert2105 7 лет назад +1

    thanks !!

  • @bipul2138
    @bipul2138 6 лет назад +1

    awesome

  • @noorhassanwazir8133
    @noorhassanwazir8133 4 года назад

    Sir why are u reducing sumcount for index "number" by 1 each time whenever u put element in stored input?

  • @amirrezaavani2234
    @amirrezaavani2234 6 лет назад +1

    Fantastic

  • @cskwillreturn2473
    @cskwillreturn2473 6 лет назад

    While the two 4's in the second example does not maintain the order as in input, how could they call counting sort as stable?

  • @chandrasekharpokuri9644
    @chandrasekharpokuri9644 6 лет назад

    U have taken example in simple way....but in complicate problem like 62,13,45,58,98,81 we have to write index from 13 to 98 is time waste process...... so the process fails

  • @mohammadkarami8984
    @mohammadkarami8984 4 года назад

    Thanks

  • @teenmastr
    @teenmastr 7 лет назад

    I'm Yusuf too. I'll be posting videos soon.

  • @korinostream
    @korinostream 7 лет назад +1

    thank you

  • @jubinkuriakose
    @jubinkuriakose 7 лет назад

    Thanks this helped! so counting sort aren't stable looks like.

    • @lokeshkanna6042
      @lokeshkanna6042 7 лет назад

      it is a stable one. He made a mistake by filling the output array from the input array's left to right. It should be done from right to left.

  • @subbuch89
    @subbuch89 8 лет назад

    Yusuf, you did a great job. If it has voice over, the view count would have been over a 100K. Cheers man!!

    • @yusufshakeel
      @yusufshakeel  8 лет назад

      +Venkat Cheedella thanks for the appreciation sir :-)

  • @mohankumarbalasubramani3410
    @mohankumarbalasubramani3410 8 лет назад +4

    isnt counting sort suppose to be done in reverse order.

  • @khaled1231
    @khaled1231 7 лет назад

    شكرا لك (بالعربي) :)

  • @easytutorialpoint5931
    @easytutorialpoint5931 4 года назад

    If the maximum no is 70 then what should be done then there is create mor index

  • @naufaladi.youtube
    @naufaladi.youtube 7 лет назад

    best foken tutorial, thanks m8

  • @ayeshamirza7687
    @ayeshamirza7687 5 лет назад

    yousaf bhai can u plz guide which software u use to make this sort of videos??? plz ans

  • @rb1471
    @rb1471 7 лет назад

    Why not output the "Index" value "sumCount" number of times instead of calculating position?

  • @chzubair6512
    @chzubair6512 8 лет назад

    thanku sir