title: Counting sort a list in descending order
body: <p>So basically I want to figure out how to reverse a counting sort. This is the code I found:</p>
  <pre><code>def countingSort(myList):
      maxValue = 0
      for i in range(len(myList)):
          if myList[i] &gt; maxValue:
              maxValue = myList[i]
  
      buckets = [0] * (maxValue + 1)
  
      for i in myList:
          buckets[i] += 1
  
      i = 0
      for j in range(maxValue + 1):
           for a in range(buckets[j]):
               myList[i] = j
               i += 1
  
      return myList
  
  if __name__ == '__main__':
      sortedList = countingSort([1,23,4,5,6,7,8])
      print(sortedList)
  </code></pre>
  <p>So I decided to change line 16 to this:</p>
  <pre><code>i -= 1
  </code></pre>
  <p>The results are very close, but I get this:</p>
  <pre><code>[1, 23, 8, 7, 6, 5, 4]
  
  </code></pre>
  <p>My issue is that 1 is before 23 for some reason. I tried reverting some of the other signs, but it usually results in an out of bounds error. Any ways to work around it?</p>