Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program to implement counting sort algorithm
- Enter the number of Elements to be sorted :15
- Enter the number of Elements to be sorted : 15
- Enter the elements to be sorted :1 32 95 75 888 0 123 95 44 2222 444 77 852 62 32
- Enter the elements to be sorted : 1 32 95 75 888 0 123 95 44 2222 444 77 852 62 32
- The list of elements before sorting is :
- 1 32 95 75 888 0 123 95 44 2222 444 77 852 62 32
- After dividing by 10 the buckets are :
- Bucket 0 : 0
- Bucket 1 : 1
- Bucket 2 : 32 2222 852 62 32
- Bucket 3 : 123
- Bucket 4 : 44 444
- Bucket 5 : 95 75 95
- Bucket 7 : 77
- Bucket 8 : 888
- After dividing by 100 the buckets are :
- Bucket 0 : 0 1
- Bucket 2 : 2222 123
- Bucket 3 : 32 32
- Bucket 4 : 44 444
- Bucket 5 : 852
- Bucket 6 : 62
- Bucket 7 : 75 77
- Bucket 8 : 888
- Bucket 9 : 95 95
- After dividing by 1000 the buckets are :
- Bucket 0 : 0 1 32 32 44 62 75 77 95 95
- Bucket 1 : 123
- Bucket 2 : 2222
- Bucket 4 : 444
- Bucket 8 : 852 888
- After dividing by 10000 the buckets are :
- Bucket 0 : 0 1 32 32 44 62 75 77 95 95 123 444 852 888
- Bucket 2 : 2222
- After dividing by 100000 the buckets are :
- Bucket 0 : 0 1 32 32 44 62 75 77 95 95 123 444 852 888 2222
- The sorted list is :
- 0 1 32 32 44 62 75 77 95 95 123 444 852 888 2222
- Process finished with exit code 0
Add Comment
Please, Sign In to add comment