Reorganzed source and finished median pivot selection in quicksort