int leftptr left /right of first elem int rightptr right /left of pivot while(truewhile(leftptr right &/find bigger item thearray[++leftptrpivot/(nopwhile(rightptr left &/find smaller item thearray[--rightptrpivot/(nopif(leftptr >rightptr/if pointers crossbreak/partition done else /not crossedso swap(leftptrrightptr)/swap elements /end while(truereturn leftptr/return partition /end partitionit(//public void swap(int dex int dex /swap two elements double temptemp thearray[dex ]/ into temp thearray[dex thearray[dex ]/ into thearray[dex temp/temp into /end swap///end class arraypar ///////////////////////////////////////////////////////////////class partitionapp public static void main(string[argsint maxsize /array size arraypar arr/reference to array arr new arraypar(maxsize)/create the array for(int = <maxsizej++/fill array with /random numbers double (int)(java lang math random()* )arr insert( )arr display()/display unsorted array double pivot /pivot value