   def quick(arr, left, right) do
     {arr, index} = partition(arr, left, right)
 
-    if (left < index - 1), do: arr = quick(arr, left, right - 1)
+    if (left < index - 1), do: arr = quick(arr, left, index - 1)
     if (index < right), do: arr = quick(arr, index, right)
 
     arr

  end
end

array = [2, 3, 1, 5, 4]

array_sorted = Sort.quick(array, 0, length(array))


      true ->
        if (i <= j) do
          arr = swap(arr, i, j)
          compare(arr, i+1, j-1, pivot)
        else
          {arr, i}
        end
    end
  end

