Count Sort | Time and Space | Data Structure and Algorithms in JAVA

แชร์
ฝัง
  • เผยแพร่เมื่อ 29 ม.ค. 2025

ความคิดเห็น • 84

  • @mallikarjunpidaparthi
    @mallikarjunpidaparthi 4 ปีที่แล้ว +16

    Wow! Your patience is unmatchable sir! Thank you

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +2

      Thankyou beta!
      keep learning and keep loving Pepcoding😊

  • @rajivsahu983
    @rajivsahu983 4 ปีที่แล้ว +18

    Bhaiya aapki explanation is out of the world. Wish aap se padh pate batch m humlog.

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Thank you so much for so support

  • @AyushKumar-fk5lm
    @AyushKumar-fk5lm 3 ปีที่แล้ว +5

    Best teacher of Data Structures I've ever seen!!

  • @shauryasingh9801
    @shauryasingh9801 3 ปีที่แล้ว +2

    this is the best explanation,tried many videos
    dont run behind short videos ,watch this video till end without any hurry the concept will be crystal clear
    thank you so much!!

  • @adityagupta1805
    @adityagupta1805 4 ปีที่แล้ว +9

    Sir, you make this complex algorithm so much understandable and very easy Hats off to you.

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Glad to hear that, keep watching and keep learning😊🙏

    • @saurabhsingh-zm9zh
      @saurabhsingh-zm9zh ปีที่แล้ว

      @@Pepcoding yes sir out of all at last i came to u ..and found your vedios very easy to understand

  • @faizanhaider3953
    @faizanhaider3953 2 ปีที่แล้ว

    Ek he to Dil h sir kitni baar jitoGai... Har ek video pe aap Dil jit Leto sir. Aab kaha se laun itna Dil sir...🙏 BTW explanation is too too GOOD 🔥

  • @sangramkesharighosh1698
    @sangramkesharighosh1698 2 ปีที่แล้ว

    Sir you are the greatest of all.

  • @HimanshuKumar-hm4wv
    @HimanshuKumar-hm4wv 3 ปีที่แล้ว +1

    Thankyu so much sir your explanation level is unmatachable

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Please visit nados.pepcoding.com to watch more detailed and curated content on DSA, Web Dev etc. with a better user experience

  • @rishabhgoyal2835
    @rishabhgoyal2835 4 ปีที่แล้ว +8

    best explanation ..keep uploading more like this : )

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      I will try my best

  • @vivekprasad5669
    @vivekprasad5669 4 ปีที่แล้ว +8

    Understood every bit of this video, also, I was able to explain it to myself again on notebook. Thankyou sir. Everyday I'm getting better in DS Algo bit by bit with help of your videos😄

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

    • @vivekprasad5669
      @vivekprasad5669 4 ปีที่แล้ว

      @@Pepcoding Will definitely do sir

  • @shivendumishra2804
    @shivendumishra2804 2 ปีที่แล้ว

    Hats off for the explanation.

  • @prachisingh5771
    @prachisingh5771 ปีที่แล้ว

    thanks a lot sir..thoroughly explained each point

  • @shreyasingh7833
    @shreyasingh7833 4 ปีที่แล้ว +1

    Sir this was the best explanation for Count Sort so far. Thank you sir for this lecture :)

  • @notyournormaldev1419
    @notyournormaldev1419 4 ปีที่แล้ว +2

    Most best explanation of this sort specifically 👌

  • @aditigautam9703
    @aditigautam9703 2 ปีที่แล้ว

    One of the best explanation. Really hats off to you Sir . This video's explanation absorbed in mind very well. Thankyou for such great explanation !!

  • @Pooja-xu4lp
    @Pooja-xu4lp 3 ปีที่แล้ว +1

    Great visual on how and what to do. If possible kindly please also share a video on "mathematically, why this algorithm works" because this doesn't compare the elements among themselves, rather works on positioning using constant space. How as an algorithm developer would have figured this pattern which makes the sorting work always (provided we have space for the range)

  • @mayankkakkar621
    @mayankkakkar621 3 ปีที่แล้ว

    You explained it so well sir that everyone will be able to understand it. I really enjoyed learning from this video.
    Thanks ☺️

  • @Rajatkumar-tg3es
    @Rajatkumar-tg3es 3 ปีที่แล้ว +1

    Sir we are very thankful for such great videos

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      Glad you liked it!
      Keep learning.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

  • @aryangrover7216
    @aryangrover7216 4 ปีที่แล้ว +2

    Bhut Mast smjhaaya Sir

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      I am glad you liked it. I also hope that you are watching till end and trying to understand the what, how and especially why of the problem.
      If you like our efforts, we request a review - g.page/Pepcoding/review?rc

  • @rohanjaiswal64
    @rohanjaiswal64 3 ปีที่แล้ว

    BEST TEACHER!! SUMMET SIR , BHT BADHIYA

  • @JamesHalpert8555
    @JamesHalpert8555 3 ปีที่แล้ว

    Excellent explanation as always :) !!

  • @abhishekkumaryadav652
    @abhishekkumaryadav652 3 ปีที่แล้ว

    Awesome sir, thanks for your effort

  • @himanshuchhikara4918
    @himanshuchhikara4918 4 ปีที่แล้ว +1

    sir this is the best explanation of count sort

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Keep watching. I am so glad it could help you.

  • @youngshahrukhkhan8179
    @youngshahrukhkhan8179 3 ปีที่แล้ว

    Very Nice Explanation......Keep making videos

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      Keep learning, Keep growing and keep loving Pepcoding!😊

  • @luckyismynickname
    @luckyismynickname 3 ปีที่แล้ว

    What a explanation sir ji tussi great ho

  • @sushilvarande6223
    @sushilvarande6223 4 ปีที่แล้ว

    No.1 Explanation sir ...

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thankyou beta!
      Keep supporting and keep loving Pepcoding😊
      If you like our efforts, will you like to review us here - g.page/Pepcoding/review?rc

  • @programmer5280
    @programmer5280 3 ปีที่แล้ว +1

    Sir you are best🙂.

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      Glad to know that you liked the content and thank you for appreciating.
      The love and respect which I get from you people keep me highly motivated and the same I am able to forward It to you people through my videos.
      So, keep motivating, keep learning and keep loving Pepcoding😊

  • @iffyaiyan8942
    @iffyaiyan8942 4 ปีที่แล้ว

    Thanks a lot Sumit Sir, for the video finally I got this concept

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Thankyou beta. I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/How-do-I-start-learning-or-strengthen-my-knowledge-of-data-structures-and-algorithms )

  • @aapoopee1239
    @aapoopee1239 3 ปีที่แล้ว

    U solved my doubt of why we need cumulative freq array ty

    • @utkarsh_108
      @utkarsh_108 3 ปีที่แล้ว

      for a stable sort algo

  • @VivekGupta-pl2gz
    @VivekGupta-pl2gz 2 ปีที่แล้ว

    Sir, I wish if you were my teacher in my college.

  • @shreyasingh1258
    @shreyasingh1258 4 ปีที่แล้ว +3

    no one like sumeet bhaiya hands down!!🙌🙌

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      Thank you. I request you to write about us on linkedin. Also share and subscribe

  • @dhyeypatel7449
    @dhyeypatel7449 4 ปีที่แล้ว

    wow sir great work , thank u so much

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thankyou beta!
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @pranjalsharma499
    @pranjalsharma499 4 ปีที่แล้ว

    Sir aap Awesome hai

  • @Saurabh-fe2bg
    @Saurabh-fe2bg 2 ปีที่แล้ว

    thanks sir

  • @akashsharma143
    @akashsharma143 3 ปีที่แล้ว

    and I was trying to do it in place.

  • @akshaykumarmalathkar2968
    @akshaykumarmalathkar2968 2 ปีที่แล้ว

    What if the array elements are negative, how do we apply count sort then?

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 4 ปีที่แล้ว +1

    Feynman every physics student lover love u sir

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thank you so much beta ji!! share kr di jieega

    • @anjneykumarsingh4461
      @anjneykumarsingh4461 4 ปีที่แล้ว +1

      Sure sir apko bolna nhi h sirji. We are your student it's our duty to study well spread a name proud pepcoder

  • @gauravkumar0777
    @gauravkumar0777 3 ปีที่แล้ว

    Thanks you sir for your explanation

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      If you like our efforts, please upvote the comments written by the students about Pepcoding here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @jeettewatia1018
    @jeettewatia1018 3 ปีที่แล้ว +1

    sir, what if we try to improve its space complexity to O(N) not O(N^2). How can we implement this?

  • @atulsharma3443
    @atulsharma3443 3 ปีที่แล้ว +1

    sir pepcoding ki site p jb apna solution history m jake dekhte h us question ki toa wo apne aap hat jata h history se or dubara kabhi dekhna ho history mein jake toa nhi dikhta

  • @techguy188
    @techguy188 3 ปีที่แล้ว

    Sir does this algorithm sorts in O(n) complexity ?

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว +1

      For such query, please visit naods.pepcoding.com and sign up. We will help you out. Also you can join our telegram group t.me/pepcoding

    • @techguy188
      @techguy188 3 ปีที่แล้ว

      @@Pepcoding yeah sure thanks !

  • @sanatasneem2674
    @sanatasneem2674 2 ปีที่แล้ว

    This is making me wonder that instead of frequency array .. Hashmap nahi use kar sakte? Just curious

    • @sanatasneem2674
      @sanatasneem2674 2 ปีที่แล้ว

      Oh cumulative frequency hashmap me nahi nikal paenge bcoz the sequence is not defined.

  • @__RohitDevar
    @__RohitDevar 3 ปีที่แล้ว +1

    Sir ... only bad thing about. Ur videos is u won't discuss about time complixity ........

  • @rahulranjan7567
    @rahulranjan7567 3 ปีที่แล้ว

    My Python Code to prove that COunting Sort is Stable:
    def countingSort(arr):
    mini = min([arr[i][0] for i in range(len(arr))])
    maxi = max([arr[i][0] for i in range(len(arr))])
    freqArr = [0]*(maxi-mini+1)
    # Recording the frequency of each element
    for ele in arr:
    idx = ele[0]-mini
    freqArr[idx] = freqArr[idx]+1
    # Writing the prefix Sum in freq arr
    for i in range(1,len(freqArr)):
    freqArr[i] = freqArr[i-1]+freqArr[i]
    # Declaring a new array of size equal to arr
    ans = [0]*len(arr)
    for i in range(len(arr)-1,-1,-1):
    idxOfFreqArray = arr[i][0]-mini
    valInFreqArr = freqArr[idxOfFreqArray]
    idxInResultingArray = valInFreqArr-1
    ans[idxInResultingArray] = arr[i]
    freqArr[idxOfFreqArray] = freqArr[idxOfFreqArray]-1
    return ans
    arr = [(5,1),(9,1),(6,1),(3,1),(1,1),(0,1),(8,1),(2,1),(4,1),(6,2),(8,2),(5,2),(4,2),(3,2),(9,2),(7,1)]
    print(countingSort(arr))
    Here I Used a tuple instead of numbers. The first element of every tuple is the number to be sorted and the second element of the tuple is the position of that number. Hope it helps

  • @adarshsharmanit356
    @adarshsharmanit356 3 ปีที่แล้ว

    Sir , EK Web Dev ka end to end ,
    Solid Project Ban wa do
    Chahe , Git Implement karado , B+ wala kara do ,
    Jisse off-campus Dikkat na ho ,
    Placement Season start hone wala hai

  • @khanomar9166
    @khanomar9166 4 ปีที่แล้ว

    i have a question instead of creating a new array can we just swap the element in the original array . i think it would save us some space

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Beta, I regret to inform you that, I won't be able to answer/solve the personal doubts of each and every student over here. For clearing your doubts, you can join our community on telegram - t.me/pepcoding.

  • @ashutoshjha5356
    @ashutoshjha5356 3 ปีที่แล้ว

    Epitome of DSA teacher === Sumeet Malik sir

    • @Pepcoding
      @Pepcoding  3 ปีที่แล้ว

      keep motivating, keep learning and keep loving Pepcoding😊

  • @nikhilvashisht2810222
    @nikhilvashisht2810222 3 ปีที่แล้ว

    Aakhri 6 9 pe aayega. Coincidence? I think not 😎

  • @mridulgupta4185
    @mridulgupta4185 3 ปีที่แล้ว

    Why are traversing the array from reverse side?
    It should give same result of we traverse from front side

    • @prakhargupta713
      @prakhargupta713 3 ปีที่แล้ว

      to preserve order of element having same element

    • @akash-lz2dq
      @akash-lz2dq 3 ปีที่แล้ว

      @@prakhargupta713 it will preserve order even with front traversal

  • @GopalKumar-py2cf
    @GopalKumar-py2cf 2 ปีที่แล้ว

    jis tarh se aap padha rahe koi paid course me v nahi padhata hai

  • @anjneykumarsingh4461
    @anjneykumarsingh4461 4 ปีที่แล้ว +2

    Thanku sir but u told it very. Wrong it is recorded lecture like zee cinema😢 i will prove the worth it of it.
    Although I will be joining for level up😜live class

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว +1

      cool haii ji

  • @freelygaming696
    @freelygaming696 3 ปีที่แล้ว

    khas aise university wale pda dete aaj koi khali ni hota bc 1lakh 2lkh le lete h uper se kuch krte ni h apni india ka education,hospital,neta yeah sb mil kr le rahe h