Computer Science, asked by pratapdeshmukh56, 1 month ago

how many passes will be required to sort the data using radix sort 12, 345, 121, 564, 2342, 231, 7, 989, 3231

Answers

Answered by amitnrw
1

Given : 12, 345, 121, 564, 2342, 231, 7, 989, 3231

To Find :  how many  p a s s e s will be required to sort the data using radix sort

Solution:

radix sort is a non-comparative sorting algorithm

radix sort is also  called b u c k e t sort and digital sort.

Each step requires just a single p a s s over the data as items put in b u c k e twithout comparison.

As Largest number  3231 is  4 Digit number

Hence  4 p a s s e s will be required

12, 345, 121, 564, 2342, 231, 7, 989, 3231

Using Least Significant digit

1st p a s s  checking unit Digit

{ 121 , 231 , 3231 } , { 12 , 2342 } , { 564 } , { 345 }, { 7} , {989}

2nd p a s s  checking Tens Digit

{07 } , {12 } , { 121 } , { 231 , 3231 } , { 2342 , 345 } , { 564 } , { 989 }

3rd p a s s   Checking Hundred's Digit

{ 007 , 012 } , { 121 } , { 231  , 3231 } , { 2342 , 345 } , { 564 } , { 989 }

4th p a s s   Checking Thousand Digit

{ 0007 , 0012 , 0121 , 0231 , 0345 , 0564 , 989 } , { 2342} , { 3231 }

Hence Sorted :

7 , 12 , 121 , 231 , 345 , 564 , 989 , 2342 , 3231

It can be done using most significant Digit also

Starting with checking  Thousand digit  in this case  and go  upto unit digit

Learn More:

Difference between sorting and filtering in excel - Brainly.in

brainly.in/question/8773232

perform QUICK SORT on the following data set23, 12, 11, 45, 30, 8  

https://brainly.in/question/31327614

Similar questions