Quick Sort working algorithm