GoalScope — radix_sort (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def radix_sort(arr):↵
"""Radix sort implementation."""↵
max_digit = max(arr)↵
exp = 1↵
while max_digit // exp > 0:↵
counting_sort_by_digit(arr, exp)↵
exp *= 10↵
↵
def counting_sort_by_digit(arr, exp):↵
n = len(arr)↵
output = [0] * n↵
count = [0] * 10↵
↵
for i in range(n):↵
index = arr[i] // exp↵
count[index % 10] += 1↵
↵
for i in range(1, 10):↵
count[i] += count[i - 1]↵
↵
i = n - 1↵
while i >= 0:↵
index = arr[i] // exp↵
output[count[index % 10] - 1] = arr[i]↵
count[index % 10] -= 1↵
i -= 1↵
↵
for i in range(n):↵
arr[i] = output[i]↵
</code>