Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save graphoarty/33b28b9f650795ef47fedf79fa67792a to your computer and use it in GitHub Desktop.
Save graphoarty/33b28b9f650795ef47fedf79fa67792a to your computer and use it in GitHub Desktop.
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