img
Question:
Published on: 29 March, 2024

a) Sort the following list using the Radix Sort :

189, 205, 986, 421, 97, 192, 535, 839, 562, 674

 

Answer:

a)

189, 205, 986, 421, 97, 192, 535, 839, 562, 674

First pass:

 

Input

Number

0

1

2

3

4

5

6

7

8

9

189

 

 

 

 

 

 

 

 

 

189

205

 

 

 

 

 

205

 

 

 

 

986

 

 

 

 

 

 

986

 

 

 

421

 

421

 

 

 

 

 

 

 

 

097

 

 

 

 

 

 

 

097

 

 

192

 

 

192

 

 

 

 

 

 

 

535

 

 

 

 

 

535

 

 

 

 

839

 

 

 

 

 

 

 

 

 

839

562

 

 

562

 

 

 

 

 

 

 

674

 

 

 

 

674

 

 

 

 

 

 

Second Pass:

 

Input

Number

0

1

2

3

4

5

6

7

8

9

421

 

 

421

 

 

 

 

 

 

 

192

 

 

 

 

 

 

 

 

 

192

562

 

 

 

 

 

 

562

 

 

 

674

 

 

 

 

 

 

 

674

 

 

205

205

 

 

 

 

 

 

 

 

 

535

 

 

 

535

 

 

 

 

 

 

986

 

 

 

 

 

 

 

 

986

 

097

 

 

 

 

 

 

 

 

 

097

189

 

 

 

 

 

 

 

 

189

 

839

 

 

 

839

 

 

 

 

 

 

 

Third Pass:

 

Input

Number

0

1

2

3

4

5

6

7

8

9

 

 

 

205

 

 

 

 

 

 

 

 

 

 

 

 

421

 

 

 

 

 

 

 

 

 

 

 

535

 

 

 

 

 

 

 

 

 

 

 

 

 

839

 

 

 

 

 

 

 

562

 

 

 

 

 

 

 

 

 

 

 

674

 

 

 

 

 

 

 

 

 

 

 

 

 

986

 

 

189

 

 

 

 

 

 

 

 

 

 

192

 

 

 

 

 

 

 

 

 

097

 

 

 

 

 

 

 

 

 

 

So, sorted array is

 

097

189

192

205

421

535

562

674

839

986

 

Random questions