Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. int []B=new int[300];
  2.  
  3. int[]C= new int[k];
  4.  
  5. for(int i=0;i<k;i++) {
  6. C[i]=0;
  7. }
  8. for(int j=1;j<A.length;j++) {
  9. C[A[j]]=C[A[j]]+1;
  10. }
  11. for(int i=1;i<k;i++) {
  12. C[i]=C[i]+C[i-1];
  13. }
  14. for(int j=A.length-1;j>0;j--) {
  15. B[C[A[j]]]=A[j];
  16. C[A[j]]=C[A[j]]-1;
  17. }
  18. for(int i=1;i<300;i++) {
  19. System.out.println(B[i]);
  20. }
  21. }
  22.  
  23. public void RadixSort(int []A, int d) {
  24. for(int i=1;A[i]>0;i*=10) {
  25. countingSort(A,d);
  26.  
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement