Completed
Push — master ( f90dfb...c5f758 )
by Xianshun
01:33
created

LSD   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 22
rs 10
wmc 6

1 Method

Rating   Name   Duplication   Size   Complexity  
B sort() 0 20 6
1
class LSD(object):
2
    R = 256
3
    @staticmethod
4
    def sort(a):
5
        W = len(a[0])
6
        aux = [None] * len(a)
7
8
        for d in range(W-1, -1, -1):
9
            count = [0] * (LSD.R+1)
10
11
            for i in range(len(a)):
12
                count[ord(a[i][d])+1] += 1
13
14
            for r in range(0, LSD.R):
15
                count[r+1] += count[r]
16
17
            for i in range(len(a)):
18
                aux[count[ord(a[i][d])]] = a[i]
19
                count[ord(a[i][d])] += 1
20
21
            for i in range(len(a)):
22
                a[i] = aux[i]
23