We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 38dbaef commit 0e76ee9Copy full SHA for 0e76ee9
sorts/counting_sort.py
@@ -57,8 +57,14 @@ def counting_sort(collection):
57
58
return ordered
59
60
+def counting_sort_string(string):
61
+ return ''.join([chr(i) for i in counting_sort([ord(c) for c in string])])
62
+
63
64
if __name__ == '__main__':
65
+ # Test string sort
66
+ assert "eghhiiinrsssttt" == counting_sort_string("thisisthestring")
67
68
try:
69
raw_input # Python 2
70
except NameError:
sorts/countingsort.py
0 commit comments