//1.快速排序 import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] a = new int[n]; for(int i=0;i<n;i++) { a[i] = sc.nextInt(); } qsort(a,0,n-1); for(int i=0;i<n;…
package com.wangjj.quicksort; import java.util.Arrays; /** * 快速排序 * @author Administrator * */ public class QuickSort { public static void sort(int arr[],int low,int high) { int l = low; int h = high; int key = arr[low]; //进行一趟快速排序,排序完结果,key左边的都比key小…
package com.array; public class Sort_Quick { /* * 项目名称:快速排序 ; * 项目要求:用JAVA对数组进行排序,并运用快速排序算法; * 作者:Sevck; */ public void sort(int left, int right, int array[]) { int l = left; int r = right; int pirot = array[(left + right) / 2]; int temp = 0; while (…
//快速排序: #include <stdio.h> #define MAX 500000 int s[MAX]; void Q_Sort(int start,int end) { int i,j,t; if ( start >= end ) return ; t = s[start]; i = start; j = end; while ( i < j) { while ( s[j] >= t && i < j) { j--; } s[i] = s[j…