Radix Sorting is the sorting algorithm or a type of sorting which is used to sort individual data items.Radix sorting is used when we have...
Radix Sorting is the sorting algorithm or a type of sorting which is used to sort individual data items.Radix sorting is used when we have a large list of value.Worst case Complexity of radix sort is O(var. n).This technique is used in c ++,java,c# language etc.
Radix Sorting Example:-
233,456,678,555,764,631,4326,88
=233,456,678,555,764,631,88('Sort' on base of last digit)
Phase 1:-
0
1 631
2
3 233
4 764
5 555
6 456
7
8 678,88
9
=631,233,764,555,456,678,88
Phase 2:-
0
1
2
3 631,233
4
5 555,456
6 764
7 678
8 88
9
=631,233,555,456,764,678,88
Phase 3:-
0 (0)88
1
2 233
3
4 456
5 555
6 631,678
7 764
8
9
Radix Sorting Example:-
233,456,678,555,764,631,4326,88
=233,456,678,555,764,631,88('Sort' on base of last digit)
Phase 1:-
0
1 631
2
3 233
4 764
5 555
6 456
7
8 678,88
9
=631,233,764,555,456,678,88
Phase 2:-
0
1
2
3 631,233
4
5 555,456
6 764
7 678
8 88
9
=631,233,555,456,764,678,88
Phase 3:-
0 (0)88
1
2 233
3
4 456
5 555
6 631,678
7 764
8
9
=88,233,456,555,631,678,764 (Sorted Array)
Function cum Program:-
That's all about Radix Sorting in data structure and computer science.
void radix(int a[],int n)
{
int i,r[max],exponent=1;
for(i=0;i<n;i++)
{
if(a[i]>m)
m=a[i];
}
while(m/exponent>0)
{
for(i=0;i<n;i++)
b[a[i]/exponent % 10];
for(i=1;<10;i++)
b[i]=b[i]+1;
for(i=n-1;i<n;i++)
b[a[i]/exponent % 10]=a[i];
for(i=o;i<n;i++)
{
a[i]=b[i];
}}}
That's all about Radix Sorting in data structure and computer science.
If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.
COMMENTS