• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
gaohuan30
博客园    首页    新随笔    联系   管理    订阅  订阅
2020年5月6日
归并排序
摘要: 只模拟合并的流程 package com.example.sort.merge; public class MergeSort { public static void main(String[] args) { int[] arr = {1, 4, 7, 8, 3, 6, 9}; sort(arr 阅读全文
posted @ 2020-05-06 22:42 gaohuan30 阅读(101) 评论(0) 推荐(0)
递归
摘要: 例如1: 1到10的累加 = 55 public class Recursion1 { public static void main(String[] args) { System.out.println(f(10)); } static long f(int n){ if(n<1){ retur 阅读全文
posted @ 2020-05-06 19:18 gaohuan30 阅读(136) 评论(0) 推荐(0)
希尔排序-改进的插入排序
摘要: 间隔大移动次数少,间隔小移动距离短。 public class ShellSort { public static void main(String[] args) { int[] arr = {9, 6, 11, 3, 5, 12, 8, 7, 10, 15, 14, 4, 1, 13, 2}; 阅读全文
posted @ 2020-05-06 17:14 gaohuan30 阅读(146) 评论(0) 推荐(0)
插入排序
摘要: 将数组分成两部分,左侧排序好的,右侧未排序的,然后从右侧拿数据,遍历左侧数据进行比较替换public class InsertionSort { public static void main(String[] args) { int[] arr = {9, 3, 1, 4, 6, 8, 7, 5, 阅读全文
posted @ 2020-05-06 14:57 gaohuan30 阅读(163) 评论(0) 推荐(0)
冒泡排序
摘要: package com.example.sort.bubbling; import java.util.Scanner; /** * 9 6 1 3 5 * 6 9 1 3 5 * 6 1 9 3 5 * 6 1 3 9 5 * 6 1 3 5 9 * 第一轮结束 9 从第一位 转移到了最后一位, 阅读全文
posted @ 2020-05-06 13:43 gaohuan30 阅读(127) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3