The Full Counting Sort

  • + 4 comments

    I need an explanation why would this fail some test cases?

    def countSort(arr):
        
        size = len(arr)
        mid = (size - 1)//2
        
        # Replace first half
        for k in range(mid+1):
          arr[k][1] = '-'
          
        # Sort based on x[0]
        sort = sorted(arr, key = lambda x: x[0]) 
        # Print results
        for s in sort:
          print(s[1],end = ' ')