上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页
摘要: package com.liuhuan.study.algorithms.search; import java.util.Arrays; /** * @author LiuHuan * @date 2020-07-08 16:27 * @desc 斐波那契查找 */ public class Fi 阅读全文
posted @ 2020-07-29 09:19 叮叮叮叮叮叮当 阅读(87) 评论(0) 推荐(0) 编辑
摘要: package com.liuhuan.study.algorithms.search; /** * @author LiuHuan * @date 2020-07-09 14:35 * @desc 二分查找非递归 */ public class BinarySearchNoRecur { publ 阅读全文
posted @ 2020-07-29 09:18 叮叮叮叮叮叮当 阅读(39) 评论(0) 推荐(0) 编辑
摘要: package com.liuhuan.study.algorithms.search; import java.util.ArrayList; import java.util.List; /** * @author LiuHuan * @date 2020-07-08 16:20 * @desc 阅读全文
posted @ 2020-07-29 09:17 叮叮叮叮叮叮当 阅读(73) 评论(0) 推荐(0) 编辑
摘要: /** * 基数排序 * 时间复杂度O(nlogn) * @param arr */ public static void radixSort(int[] arr) { //1. 得到数组中最大的数的位数 //假设第一数就是最大数 int max = arr[0]; for (int i = 1; 阅读全文
posted @ 2020-07-28 15:01 叮叮叮叮叮叮当 阅读(112) 评论(0) 推荐(0) 编辑
摘要: /** * 分+合方法 * * @param arr * @param left * @param right * @param temp */ public static void mergeSort(int[] arr, int left, int right, int[] temp) { if 阅读全文
posted @ 2020-07-28 14:59 叮叮叮叮叮叮当 阅读(78) 评论(0) 推荐(0) 编辑
摘要: /** * 堆排序的方法 * 时间复杂度O(nlogn) * @param arr */ public static void heapSort(int arr[]) { int temp = 0; System.out.println("堆排序!!"); //完成我们最终代码,将无序序列构建成一个 阅读全文
posted @ 2020-07-28 14:56 叮叮叮叮叮叮当 阅读(60) 评论(0) 推荐(0) 编辑
摘要: /** * 希尔排序时, 对有序序列在插入时采用交换法 * 时间复杂度O(n^(1.3-2)) * @param arr */ private static void shellSort(int[] arr) { int temp = 0; int count = 0; // 使用循环处理 for 阅读全文
posted @ 2020-07-28 14:52 叮叮叮叮叮叮当 阅读(84) 评论(0) 推荐(0) 编辑
摘要: /** * 插入排序 * 时间复杂度O(n^(1-2)) * @param arr */ private static void insertSort(int[] arr) { int insertVal = 0; int insertIndex = 0; for (int i = 1; i < a 阅读全文
posted @ 2020-07-28 14:50 叮叮叮叮叮叮当 阅读(54) 评论(0) 推荐(0) 编辑
摘要: /** * 快速排序 * 时间复杂度O(nlogn) * @param arr * @param left * @param right */ private static void quickSort(int[] arr, int left, int right) { //左下标 int l = 阅读全文
posted @ 2020-07-28 14:47 叮叮叮叮叮叮当 阅读(72) 评论(0) 推荐(0) 编辑
摘要: /** * 选择排序 * 时间复杂度是 O(n^2) * @param arr */ private static void selectSort(int[] arr) { for (int i = 0; i < arr.length - 1; i++) { int minIndex = i; in 阅读全文
posted @ 2020-07-28 14:45 叮叮叮叮叮叮当 阅读(53) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 13 下一页