input: Write a function to optimize the sorting of a given set of numbers to achieve O(n) time complexity. The function should take an unsorted list as input and return the sorted list.
  
  def sort_list(unsorted_list):
      count = [0] * (9)
      for num in unsorted_list:
          count[num] += 1
      sorted_list = []
      for i in range(len(count)):
          sorted_list.extend([i] * count[i])
      return sorted_list
  
  assert sort_list([2, 6, 3, 8, 4]) == [2, 3, 4, 6, 8]
output: def sort_list(unsorted_list):
      count = [0] * (9)
      for num in unsorted_list:
          count[num] += 1
      sorted_list = []
      for i in range(len(count)):
          sorted_list.extend([i] * count[i])
      return sorted_list