排序
文章平均质量分 74
zjj582984208
这个作者很懒,什么都没留下…
展开
-
插入排序
1.使用交换排序:package chapter7;public class Demo1 { public static void main(String[] args) { Integer a[] = { 34, 8, 64, 51, 32, 21 }; insertionSort(a); } public static > void insertionSort(In原创 2017-02-23 16:42:54 · 215 阅读 · 0 评论 -
希尔排序
希尔排序是通过比较相距一定间隔的元素来工作的,也叫缩减增量排序package chapter7;public class Demo2 { public static void main(String[] args) { Integer a[] = { 34, 8, 64, 80, 32, 21 }; shellSort(a); } public static > voi原创 2017-02-23 20:18:45 · 205 阅读 · 0 评论 -
排序之冒泡,选择,插入,希尔
Java代码:package cho2;public class Array { public static void main(String[] args) { int[] arr = { 12, 56, 79, 45, 63 }; System.out.print("原数组为:"); Array.display(arr); System.out.println();原创 2017-03-15 16:57:10 · 192 阅读 · 0 评论 -
排序之快速排序
Java代码:package cho2;public class quickSort { public static void main(String[] args) { int[] numbers = { 10, 20, 15, 0, 6, 7, 2, 1, -5, 55 }; System.out.print("排序前:"); printArr(numbers);原创 2017-03-15 16:58:26 · 234 阅读 · 0 评论 -
排序之堆排序
Java代码:package cho2;import java.util.Arrays;public class HeapSort { public static void main(String[] args) { int[] a = { 31, 41, 59, 26, 53, 58, 97 }; for (int i = 0; i < a.length - 1; i++)原创 2017-03-15 16:59:35 · 218 阅读 · 0 评论 -
排序之归并排序
Java代码:package cho2;public class mergeSort { public static int[] sort(int[] nums, int low, int high) { int mid = (low + high) / 2; if (low < high) { // 左边 sort(nums, low, mid); // 右边原创 2017-03-15 17:00:38 · 235 阅读 · 0 评论 -
数组对象排序
经典学生类:Java代码:package cho2;public class TestStudentArray { public static void main(String[] args) { StudentArray sArr = new StudentArray(); Student st1 = new Student(100, "d张三", "男", 20);原创 2017-03-15 21:39:43 · 327 阅读 · 0 评论