m2skills

Bucket sort op

Sep 28th, 2017
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. Program to implement counting sort algorithm
  2. Enter the number of Elements to be sorted :15
  3. Enter the number of Elements to be sorted : 15
  4. Enter the elements to be sorted :1 32 95 75 888 0 123 95 44 2222 444 77 852 62 32
  5. Enter the elements to be sorted : 1 32 95 75 888 0 123 95 44 2222 444 77 852 62 32
  6.  
  7. The list of elements before sorting is :
  8. 1 32 95 75 888 0 123 95 44 2222 444 77 852 62 32
  9. After dividing by 10 the buckets are :
  10. Bucket 0 : 0
  11. Bucket 1 : 1
  12. Bucket 2 : 32 2222 852 62 32
  13. Bucket 3 : 123
  14. Bucket 4 : 44 444
  15. Bucket 5 : 95 75 95
  16. Bucket 7 : 77
  17. Bucket 8 : 888
  18.  
  19. After dividing by 100 the buckets are :
  20. Bucket 0 : 0 1
  21. Bucket 2 : 2222 123
  22. Bucket 3 : 32 32
  23. Bucket 4 : 44 444
  24. Bucket 5 : 852
  25. Bucket 6 : 62
  26. Bucket 7 : 75 77
  27. Bucket 8 : 888
  28. Bucket 9 : 95 95
  29.  
  30. After dividing by 1000 the buckets are :
  31. Bucket 0 : 0 1 32 32 44 62 75 77 95 95
  32. Bucket 1 : 123
  33. Bucket 2 : 2222
  34. Bucket 4 : 444
  35. Bucket 8 : 852 888
  36.  
  37. After dividing by 10000 the buckets are :
  38. Bucket 0 : 0 1 32 32 44 62 75 77 95 95 123 444 852 888
  39. Bucket 2 : 2222
  40.  
  41. After dividing by 100000 the buckets are :
  42. Bucket 0 : 0 1 32 32 44 62 75 77 95 95 123 444 852 888 2222
  43.  
  44. The sorted list is :
  45. 0 1 32 32 44 62 75 77 95 95 123 444 852 888 2222
  46. Process finished with exit code 0
Add Comment
Please, Sign In to add comment