Count Sort | C++ Placement Course | Lecture 20.1

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Counting Sort:-

Pros:
-Time Complexity O(N)
- Compareless sorting

Cons:
-Limited Usage i.e for int
-Memory Consuption

Uses:
- Sort numbers
- find counts of letter from string
- remove duplicate from string
- find kth smallest or biggest element from array within O(N) time.

HAPPY LEARNING :)

rutvikrana
Автор

The people who come up with these ideas of sorting algorithms are true legends
How can they think so far

maulikshah
Автор

dynamic array can be allocated : int* count = new int [ k ];

karanjaiswal
Автор

When God come to help poor students ❤️

anuragtyagi
Автор

ig, the size of count array could be k+1 and terminating condition of loop should also be (i <k+1) not(i< n). someone pls help me with this doubt.

ayushgarg
Автор

If you create an array on the heap, such as with int* arr = new int[n]; --> the time complexity is O(n).

If you create an array on the stack, such as with int arr[n]; --> the time complexity is O(1).

AliShair-fq
Автор

Salute to the team🇮🇳!
You all are really helping lots of students and has made education, fun to learn with easy explanation

radhikaagarwal
Автор

We can create a count array of size (k+1) instead of size 10.

mohammadrafi
Автор

Bhai apni kaksha channel pe please biology daaalde yaar.Biology ke liye hee sab se zyada zarurat hai animation

anirudh
Автор

The trick I did is create Madeleine plus 1 as size of counter array that will solve future memory overflow

parthapratimghose
Автор

// I think the final procedure (output array) is better in my idea
void countSort(int a[], int n){
int k=a[0];
for(int i=1;i<n;i++) k=max(k, a[i]);
int count[10]={0};
for(int i=0;i<n;i++) count[a[i]]++;
int j=0;
for(int i=0;i<=k;i++)
while(count[i]--){
a[j]=i;
j++;
}
}

extremesatyaiitjeeair
Автор

it can be sorted in javascript by performing this: arr.sort(function(a, b){return a-b})...this will return the same output

dhruvchokshi
Автор

Time complexity explained in only 2 minutes 😑...it should be explained in details
But all over I love this playlist❤️

uttamkarmakarece
Автор

These sorting algorithms are really great.
But still, you forgot about some legendary sorting techniques.
1. Bogo Sort
2. BogoBogo Sort
3. Miracle Sort
4. The Schrodinger's Sort

aniketmani
Автор

FAANG Motivation video: 1day - 1million views
Actual knowledge to crack FAANG companies: 1year - 50k views

What's the use of motivation without hardwork?

anuragpandey
Автор

up to date i fallow this course and i feel and i know competitor of this course is not available on todays market.

irannapatil
Автор

The best things happen for students in 2020 is Aman bhaiya and his team come with this teaching facilities ....thank you bhaiya Definately we will make you proud ...just wait ❤️❤️❤️❤️❤️❤️

ankitwaghmare
Автор

Ohho... Wo last me "byee".. Maje aa gye

harshwasnik
Автор

When yoou are at another level of coding
Thank you aman sir and team ... l

shubhamkale
Автор

why we need to find the maximum element of an array while after we initialise the count array size 10.

gtictil