We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f361dd commit 27d53fbCopy full SHA for 27d53fb
1 file changed
algorithms/sort/radix_sort.py
@@ -2,10 +2,14 @@
2
radix sort
3
complexity: O(nk) . n is the size of input list and k is the digit length of the number
4
"""
5
-def radix_sort(arr):
+def radix_sort(arr, simulation=False):
6
is_done = False
7
position = 1
8
9
+ iteration = 0
10
+ if simulation:
11
+ print("iteration",iteration,":",*arr)
12
+
13
while not is_done:
14
queue_list = [list() for _ in range(10)]
15
is_done = True
@@ -22,5 +26,9 @@ def radix_sort(arr):
22
26
arr[index] = num
23
27
index += 1
24
28
29
30
+ iteration = iteration + 1
31
32
25
33
position *= 10
34
return arr
0 commit comments