Skip to content

Commit 0e76ee9

Browse files
camilneAnshulMalik
authored andcommitted
Remove duplicate counting sort (TheAlgorithms#376)
1 parent 38dbaef commit 0e76ee9

File tree

2 files changed

+6
-42
lines changed

2 files changed

+6
-42
lines changed

sorts/counting_sort.py

+6
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ def counting_sort(collection):
5757

5858
return ordered
5959

60+
def counting_sort_string(string):
61+
return ''.join([chr(i) for i in counting_sort([ord(c) for c in string])])
62+
6063

6164
if __name__ == '__main__':
65+
# Test string sort
66+
assert "eghhiiinrsssttt" == counting_sort_string("thisisthestring")
67+
6268
try:
6369
raw_input # Python 2
6470
except NameError:

sorts/countingsort.py

-42
This file was deleted.

0 commit comments

Comments
 (0)