input: Write a function to implement quicksort algorithm.
  assert quicksort([1, 5, 8, 7, 2]) == [1, 2, 5, 7, 8]
  assert quicksort([10, 3, 15, 7, 8, 23, 74, 18]) == [3, 7, 8, 10, 15, 18, 23, 74]
  assert quicksort([5, 3, 8, 4, 2]) == [2, 3, 4, 5, 8]
output: def quicksort(arr):
      if len(arr) <= 1:
          return arr
      pivot = arr[len(arr) // 2]
      left = [x for x in arr if x < pivot]
      middle = [x for x in arr if x == pivot]
      right = [x for x in arr if x > pivot]
      return quicksort(left) + middle + quicksort(right)