public int partition(double[] arr, int start, int end, double pivot) {
    int i = start;
    int j = end - 1;
    while (true) {
      while (i < end && arr[i] < pivot) {