算法与数据结构
思考决定高度
这个作者很懒,什么都没留下…
展开
-
插入排序
public class InsertSortVersion3 { public static void insertSort(int[] arr){ for (int i = 0;i<arr.length;i++){ insertIndex(arr,i); } } /** * 到x元素的位置都是...原创 2020-03-03 13:31:28 · 79 阅读 · 0 评论 -
冒泡排序的进化版-选择排序
public class SelectSortVersion3 { public static void selectSort(int[] arr){ boolean sort = false; int lastIndex = arr.length-1; while (!sort) { sort = true; ...原创 2020-03-03 13:30:02 · 88 阅读 · 0 评论 -
不一样的冒泡排序,通俗易懂
public class BubbleSortVersion6 { public static void bubbleSort(int[] arr){ // 默认未排好序 boolean sort = false; // 循环次数 每次确定的最值元素的位置 int lastIndex = arr.length-1; ...原创 2020-02-22 17:56:17 · 90 阅读 · 0 评论 -
LinkedList实现
package linkedlist;import java.util.LinkedList;public class LinkedListVersion2<T> { private Entry<T> first; private Entry<T> last; class Entry<T>{ p...原创 2019-12-28 10:33:58 · 62 阅读 · 0 评论 -
对1,2,3,4,5进行组合,写一个Java函数实现所有组合方式
今天的一道面试题,下面是代码,如果有更好的写法,欢迎分享;package com.suanfa;import java.util.ArrayList;public class Combination { public void f(int[] arr) { for(int i=0;i<arr.length;i++){ ...原创 2019-07-04 21:40:40 · 1468 阅读 · 1 评论