算法
yicaifenchen8
追逐梦想,挑战极限,缔造完美,拥抱明天。
微信/QQ:819632763
展开
-
算法 二分查找
public class search { public static void main(String[] args) { int[] a = {1, 4, 5, 6, 8, 9}; int ret = binary(a, 9); System.out.println(ret); } public static ...原创 2018-08-24 10:29:23 · 104 阅读 · 0 评论 -
算法 选择排序 冒泡排序
public class sort { public static void main(String[] args) { int[] a = {4, 5, 3, 3, 2, 7, 1, 9}; select(a);// mp(a); System.out.println(Arrays.toString(a)...原创 2018-08-24 10:30:45 · 114 阅读 · 0 评论 -
巧思妙解 趣味算法题
题目输出如下图形* * * * * * ** * * ** * * ** * ** * * ** * * ** * * * * * *源码 public static void main(St...原创 2019-12-24 18:12:05 · 241 阅读 · 0 评论 -
巧思妙解 一行代码实现颜色按指定顺序排序算法题
题目方法一public static void main(String[] args) throws Exception { char[] a = "红黄红黄红红红黄蓝黄蓝".toCharArray(); Arrays.sort(a); System.out.println(new String(a).replace("红","1") ...原创 2019-12-24 17:28:34 · 404 阅读 · 0 评论 -
巧思妙解 一行代码实现生成包含大小写字母和数字的算法题
题目生成包含大小写字母和数字的算法题解法public static void main(String[] args) throws Exception { for (int i = 0; i < 6; i++) out.print((char) (random() > 0.5 ? random() * 26 + 65 + round(random()) *...原创 2019-12-24 17:12:21 · 225 阅读 · 0 评论 -
算法 线性排序-计数排序
public class BaseSort { public static int[] sort(int a[]) { int max = Integer.MIN_VALUE; for (int i = 0; i < a.length; i++) if (a[i] > max) m...原创 2015-06-17 16:14:45 · 349 阅读 · 0 评论 -
算法 线性排序-区间法
public class Sort { public static int[] sort(int[] a) { int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; Map<Integer, Integer> counts = new HashMap<Int...原创 2015-06-17 15:19:40 · 443 阅读 · 0 评论