Show the steps that a radix sort takes when sorting the foll

Show the steps that a radix sort takes when sorting the following array of Integer keys:
783   99   472   182   264   543   356   295   692   491   94

Solution

Radix sort works sorting on the basis of 1s place then 10s place then 100s place and so on.

Original list

783 99 472 182 264 543 356 295 692 491 94

1) Sort 1s place

Put elements with lowest number in 1s place

a) 1 - 491

b) 2 - 472 182 692 (the order in which elements are present in original list

c) 3 - 783,543

d) 4 - 264,94

e) 5 - 295

f) 6- 356

g) 9 - 99

So now list becomes : 491, 472 182, 692,783,543,264,94,295,356,99

2) Now sort list at 10s place

a) 4- 543

b) 5- 356

c) 6- 264

d) 7 - 472

e) 8 - 182 , 783

f) 9 - 491, 692, 94, 295,99

Now list becomes

543, 356,264, 472,182 ,783,491, 692, 94,295,99

3) Now sort for 100s place

a) Nothing at 100s place : 94,99

b) 1- 182

c) 2- 264, 295

d) 3- 356

e) 4- 472,491

f) 5- 543

g) 6- 692

h) 7 - 783

Now the final list becomes

94,99,182,264,295,472,491,543,692,783

Show the steps that a radix sort takes when sorting the following array of Integer keys: 783 99 472 182 264 543 356 295 692 491 94SolutionRadix sort works sorti
Show the steps that a radix sort takes when sorting the following array of Integer keys: 783 99 472 182 264 543 356 295 692 491 94SolutionRadix sort works sorti

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site