/* Program to demonstrate radix sort */ /* Some textbooks and some teachers call radix sort as bucket sort i.e. they consider radix sort and bucket sort same. However, in some textbooks bucket sort is considered to be that sorting technique in which the numbers to be sorted must be of ONLY ONE DIGIT while radix sort can sort numbers with MULTIPLE DIGITS. Personally, I follow the practice in which they are considered different. You may follow what your college techers tell you.*/ #include #include void radixsort(int x[ ], int n) ; void show(int x[ ], int n) ; void main() { int i, n, x[20] ; clrscr() ; printf("Enter the number of elements: ") ; scanf("%d",&n) ; printf("Enter the elements:\n") ; for(i=0 ; imax) max=x[i] ; /* Finding the number of digits in largest number which will be equal to the total number of passes */ passes=0 ; while(max>0) { max=max/10 ; passes++ ; } /* Starting radix sort */ divisor = 1 ; for(digit=1 ; digit<=passes ; digit++) { for(i=0 ; i<10 ; i++) count[i]=0 ; /* Copying elements from the array into the buckets */ for(i=0 ; i