I found an implementation of Quicksort here, and now I cannot understand why it works with those left and right bounds.Right now the link above is unavailable due to some problems with their hosting provider.public class Main {    public static void main(String[] args) {        int array[] = new int[] {                10, 3, 2, 5, 4        };        System.out.println(array ==  + Arrays.toString(array));        quickSortModified(array, 0, array.length - 1);        System.out.println(sorted array ==  + Arrays.toString(array));    }    private static int partition(int arr[], int left, int right) {        int i = left, j = right;        int tmp;        int pivot = arr[(left + right) / 2];        while (i <= j) {            while (arr[i] < pivot)                i++;            while (arr[j] > pivot)                j--;            if (i <= j) {                tmp = arr[i];                arr[i] = arr[j];                arr[j] = tmp;                i++;                j--;            }        }        return i;    }    private static void quickSortModified(int arr[], int left, int right) {        int index = partition(arr, left, right);        if (left < index - 1)            quickSortModified(arr, left, index - 1);        if (index + 1 < right)            // TODO: index + 1 vs index for the bound here.            quickSortModified(arr, index + 1, right);    }}Why should left be less than index - 1, not just index?Why should index (not index + 1) be less than right?For example, on Wikipedia they use index + 1 for the second recursive call.
Quicksort bounds
algorithms;quicksort
You haven't given us the complete picture, but in general, if you are going to call quickSort on the slice of the array lo .. hi, then there is only need to do so if lo < hi; otherwise the array has at most one element and doesn't need to be sorted.