Radix Sort Explanation

Based on this article of the notation sorting http://www.geeksforgeeks.org/radix-sort/ I am struggling to understand what is explained in terms of the time complexity of certain methods in sorting.

From the link:

Let there be d digits in the input integers. Radix Sort takes O (d * (n + b)) time, where b is the base for representing numbers, for example, for the decimal system, b is 10. What is the value of d? If k is the maximum possible value, then d will be O (log_b (k)). Thus, the total time complexity is O ((n + b) * logb (k)). This is more than the time complexity of comparison-based sorting algorithms for large k. First we restrict k. Let kโ‰คnc, where c is a constant. In this case, the complexity becomes O (nlogb (n)).

So, I understand that sorting takes O (d * n), since there are d digits, so d passes, and you need to process all n elements, but I lost them from there. A simple explanation would be really helpful.

+4
source share
1 answer

Assuming we use bucket sorting to sort by each digit: for each digit, (d)we process all numbers (n), placing them in buckets for all possible values โ€‹โ€‹that a digit can have (b).

, . O(n), O(n + b) ( ), , O(d * (n + b)).

, d - , b , n. , log n, O(n log n).

+6

All Articles