算法
封景
这个作者很懒,什么都没留下…
展开
-
斐波那契数列递归算法的优化
public class Fibonacci { //优化使用的数组 static long[] cach = new long[51]; public static void main(String[] args) { long a = System.currentTimeMillis(); System.out.println( fd( 50 ) ); long l = System.currentTimeMillis(); System.out.println( l - a原创 2020-07-01 21:09:49 · 479 阅读 · 0 评论 -
小白的数组冒泡排序实现代码
public class Bubble_Sort { public static void main(String[] args) { int[] arr = {1, 5, 4, 7, 9, 3, 8, 6, 2,}; bubbleSort( arr ); } private static void bubbleSort(int[] arr) { for (int i = 0; i < arr.length - 1; i++) { for (int j = 0; j &l原创 2020-06-30 19:12:52 · 121 阅读 · 0 评论 -
数组的二分查找实现代码
public class twofenchazhao { public static void main(String[] args) { int[] arr = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int a = 6; int index = binarySearchForIndex( arr, a ); System.out.println( index ); } private static int binarySearchForIndex(i原创 2020-06-30 19:08:53 · 116 阅读 · 0 评论