# How many comparisons are needed in worst case if we have to sort 7 numbers each of 4 digit?

How many comparisons are needed in worst case if we have to sort 7 numbers each of 4 digit ?(Radix sort) Options are- 40,38,47,280 .

My solution-I have taken 10 buckets( 0 to 9)(linked list) . Then for every number for ith digit I have put it into Bucket corresponding to its digit's value. Then I collected those numbers into array back. This process is repeated for all the digits and thus my original array got sorted. Total number of comparisons= 10*4=40 (10 because I iterated through all buckets to look for corresponding bucket).

Now the problem is in the book by Timothy J Williams its given no of comparisons= no of digits* no of numbers * no of buckets= 4*7*10=280. I am not able to comprehend up. Can someone please explain how this came.

-
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}