retagged by
519 views
2 votes
2 votes

A radix sort is to be used to sort the file of non-negative integers shown below into ascending order. What would the order of the numbers be after one pass of the algorithm?
$12$ $37$ $42$ $9$ $5$ $7$ $50$ $40$ $45$ $92$
 

  1.   $12$  $37$  $42$  $40$  $45$  $5$  $50$    $7$    $9$  $92$      
  2.   $50$  $40$  $12$  $42$  $92$  $5$  $45$  $37$    $7$    $9$     
  3.   $40$  $50$  $12$  $42$  $92$  $5$  $45$  $37$    $7$    $9$     
  4.   $40$  $50$  $12$  $42$  $92$  $5$  $45$    $7$  $37$    $9$
retagged by

1 Answer

Best answer
4 votes
4 votes

In Radix Sort, we start sorting numbers by their digits at a specific place. We start from one's place, then move to ten's place, and so on.

So, after 1st pass, the array will be sorted by their digit at one's place, i.e. by their least significant digit. And to sort the digits we use a stable sort. It must be a stable sort for radix sort to work properly.

After 1st pass:

(B) 50 40 12 42 92 5 45 37 7 9

P.S. For single digit numbers, you can write them as 05, 07, etc. to avoid confusion.

selected by
Answer:

Related questions

0 votes
0 votes
1 answer
1
Bikram asked Jan 16, 2017
344 views
How many times $fibon$$\left ( 3 \right )$ is called during invocation of $fibon$ $\left ( 6 \right )$?$fibon(x) = fibon(x-1) + fibon(x-2)$$fibon(0) = 1$$fibon(1) = 1$345...
4 votes
4 votes
2 answers
3
Bikram asked Jan 16, 2017
886 views
Hash a list of $3$ keys into hash table with $20$ locations. What will be the probability of the event $A$ in which hashing the three keys causes a collision?$0.123$$0.14...
0 votes
0 votes
1 answer
4