堆排序
利用数组和二叉树的相互转化,可以利用树结构的特点,进行排序 测试了速度。因为要经常交换。所以速度和希尔排序比慢了2倍 package a; import sun.security.util.Length; import java.util.Arrays; public class HeapSortDemo { public static void main(String[] args) { int var = 8000000; int[] arr = new int[var]; for (int i = 0; i < arr.length; i++) { arr[i] = (int)(Math.random()*800000000); } long sta = System.currentTimeMillis(); // int[] arr = {4, 6, 8,5, 9,-10,100,87,93,1986756,-1000}; heapSort(arr); long end = System.currentTimeMillis(); System.out.println(end-sta); // System.out.println(Arrays.toString(arr)); } private static void heapSort(int[] arr) { System