Created
March 3, 2019 03:08
-
-
Save graphoarty/33b28b9f650795ef47fedf79fa67792a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def main(): | |
toSortArray = list() | |
counterArray = list() | |
sortedArray = list() | |
lengthOfArray = 10 | |
for x in range(0, lengthOfArray): | |
toSortArray.append(random.randint(0,lengthOfArray-1)) | |
counterArray.append(0) | |
print toSortArray | |
for x in toSortArray: | |
counterArray[x] += 1 | |
for x in range(0,len(counterArray)): | |
while counterArray[x] > 0: | |
sortedArray.append(x) | |
counterArray[x] -= 1 | |
print sortedArray | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment