**New course!**Every coder should learn

**Generative AI!**

# QuickSort problem

Hello everybody! I’m trying to implement the Quicksort algorithm but somehow I got stuck in an infinite loop and I don’t see why. Can somebody help me ? That’s the code: public class QuickSort { static void sort(int[]arr,int low, int high){ int l=low; int h=high; int q=0; if (l<h){ q=partition(arr,l,h); sort(arr,l,q); sort(arr,q+1,h); } } static int partition(int[]arr,int low, int high){ int pivot=(low+high)/2; int i=low; int j=high; while(i<=j){ while(arr[i]<pivot){ i++; } while(arr[j]>arr[pivot]){ j--; } if(i<j){ int temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; i++; j--; } } return i; } public static void main(String[] args) { int []arr={4,1,25,77,0,80,2,7,4,3}; sort(arr,0,arr.length-1); for(int i=0; i<arr.length; i++) System.out.print(arr[i]+", "); } }