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!!
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😄
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 )
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)
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
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😊
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 )
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 )
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 )
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
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
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
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.
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
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
Wow! Your patience is unmatchable sir! Thank you
Thankyou beta!
keep learning and keep loving Pepcoding😊
Bhaiya aapki explanation is out of the world. Wish aap se padh pate batch m humlog.
Thank you so much for so support
Best teacher of Data Structures I've ever seen!!
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!!
Sir, you make this complex algorithm so much understandable and very easy Hats off to you.
Glad to hear that, keep watching and keep learning😊🙏
@@Pepcoding yes sir out of all at last i came to u ..and found your vedios very easy to understand
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 🔥
Sir you are the greatest of all.
Thankyu so much sir your explanation level is unmatachable
Please visit nados.pepcoding.com to watch more detailed and curated content on DSA, Web Dev etc. with a better user experience
best explanation ..keep uploading more like this : )
I will try my best
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😄
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 )
@@Pepcoding Will definitely do sir
Hats off for the explanation.
thanks a lot sir..thoroughly explained each point
Sir this was the best explanation for Count Sort so far. Thank you sir for this lecture :)
Most best explanation of this sort specifically 👌
Thank you
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 !!
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)
You explained it so well sir that everyone will be able to understand it. I really enjoyed learning from this video.
Thanks ☺️
Sir we are very thankful for such great videos
Glad you liked it!
Keep learning.
And for better experience, visit nados.io, where you will get well curated content and career opportunities.
Bhut Mast smjhaaya Sir
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
BEST TEACHER!! SUMMET SIR , BHT BADHIYA
Excellent explanation as always :) !!
Awesome sir, thanks for your effort
sir this is the best explanation of count sort
Keep watching. I am so glad it could help you.
Very Nice Explanation......Keep making videos
Keep learning, Keep growing and keep loving Pepcoding!😊
What a explanation sir ji tussi great ho
No.1 Explanation sir ...
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
Sir you are best🙂.
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😊
Thanks a lot Sumit Sir, for the video finally I got this concept
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 )
U solved my doubt of why we need cumulative freq array ty
for a stable sort algo
Sir, I wish if you were my teacher in my college.
no one like sumeet bhaiya hands down!!🙌🙌
Thank you. I request you to write about us on linkedin. Also share and subscribe
wow sir great work , thank u so much
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 )
Sir aap Awesome hai
thanks sir
and I was trying to do it in place.
What if the array elements are negative, how do we apply count sort then?
Feynman every physics student lover love u sir
Thank you so much beta ji!! share kr di jieega
Sure sir apko bolna nhi h sirji. We are your student it's our duty to study well spread a name proud pepcoder
Thanks you sir for your explanation
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 )
sir, what if we try to improve its space complexity to O(N) not O(N^2). How can we implement this?
it already O(n)
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
ke* .
Sir does this algorithm sorts in O(n) complexity ?
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
@@Pepcoding yeah sure thanks !
This is making me wonder that instead of frequency array .. Hashmap nahi use kar sakte? Just curious
Oh cumulative frequency hashmap me nahi nikal paenge bcoz the sequence is not defined.
Sir ... only bad thing about. Ur videos is u won't discuss about time complixity ........
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
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
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
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.
Epitome of DSA teacher === Sumeet Malik sir
keep motivating, keep learning and keep loving Pepcoding😊
Aakhri 6 9 pe aayega. Coincidence? I think not 😎
Why are traversing the array from reverse side?
It should give same result of we traverse from front side
to preserve order of element having same element
@@prakhargupta713 it will preserve order even with front traversal
jis tarh se aap padha rahe koi paid course me v nahi padhata hai
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
cool haii ji
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