一.快排的一种 ==================== public class myMain { public static void main(String[] args) { int t[] = {2,6,7,8,5,4},low,high; low = 0; high = t.length-1; allSort(t,low,high); for(int t1:t){ System.out.print(t1); } } public static void allSort(int[] t
import java.util.Arrays; public class QuickSort { //三数取中法.取出不大不小的那个位置 public static int getPivotPos(int[] a,int low,int high) { int mid=(low+high)/2; int pos=low; if(a[mid]<a[low]) { int temp=a[low]; a[low]=a[mid]; a[mid]=temp; } if(a[high]<a[low])
选择排序: 简述:从数组的第一个元素开始,依次与其他所有的元素对比,如果比自身大或小(取决于升序或降序)交换位置. package com.sort; import java.util.Arrays; /** * 选择排序 */ public class ChiceSort { public static void chiceSort(int[] array) { int sum = 0; for (int i = 0; i < array.length - 1; i++) { for (int
链表文件 package sort; public class SqList { public int LIST_INIT_SIZE = 8;//链表的原始大小 private int INCREMENT = 1;//链表的增量大小 private Object[] SqList = null;//链表 private int curIndex = 0;//当前位置 /** * 初始化链表 * */ public void initList(