From edcf6d54b6304d3e3bead3b1d2d7d14d04b70aab Mon Sep 17 00:00:00 2001 From: KuLi Date: Fri, 29 Sep 2017 23:47:24 +0200 Subject: [PATCH] #130 fixed radix sort for python 3 --- sorts/radix_sort.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sorts/radix_sort.py b/sorts/radix_sort.py index 82f8a38b4..f19bc10e8 100644 --- a/sorts/radix_sort.py +++ b/sorts/radix_sort.py @@ -2,19 +2,19 @@ def radixsort(lst): RADIX = 10 maxLength = False tmp , placement = -1, 1 - + while not maxLength: maxLength = True # declare and initialize buckets buckets = [list() for _ in range( RADIX )] - + # split lst between lists for i in lst: - tmp = i / placement + tmp = i // placement buckets[tmp % RADIX].append( i ) if maxLength and tmp > 0: maxLength = False - + # empty lists into lst array a = 0 for b in range( RADIX ): @@ -22,6 +22,6 @@ def radixsort(lst): for i in buck: lst[a] = i a += 1 - + # move to next placement *= RADIX