• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
gaohuan30
博客园    首页    新随笔    联系   管理    订阅  订阅
上一页 1 2 3 4 5 6 下一页
2020年5月8日
Java-队列
摘要: 队列(Queue)是一种先进先出(First In First Out,FIFO)的线性表。它只允许在表的一端插入元素,而在表的另一端删除元素。 在队列中,允许插入元素的一端称为队尾(rear),允许删除元素的一端称为队头(front)。 1.顺序队列 队列的顺序存储结构称为顺序队列。它是利用一组地 阅读全文
posted @ 2020-05-08 16:32 gaohuan30 阅读(298) 评论(0) 推荐(0)
基数排序-非比较排序,多关键字排序
摘要: package com.example.sort.radix; import java.util.Arrays; public class RadixSort { public static void main(String[] args) { int[] arr = {421, 240, 115, 阅读全文
posted @ 2020-05-08 15:00 gaohuan30 阅读(199) 评论(0) 推荐(0)
计数排序-非比较排序
摘要: 适用场景:量大但是范围小 package com.example.sort.count; import java.util.Arrays; public class CountSort { public static void main(String[] args) { int[] arr = {2 阅读全文
posted @ 2020-05-08 12:20 gaohuan30 阅读(186) 评论(0) 推荐(0)
2020年5月7日
快速排序
摘要: 拆分数组,以最右侧为轴,小于轴的元素数组左侧,大于轴的元素数组右侧,将轴元素移到中央。 public class QuickSort { public static void main(String[] args) { int[] arr = {7, 3, 2, 8, 1, 9, 5, 4, 6}; 阅读全文
posted @ 2020-05-07 00:39 gaohuan30 阅读(121) 评论(0) 推荐(0)
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)
2020年5月1日
观察者模式(Observer)
摘要: 观察者模式地原理其实和监听器一样,使用地关键在于搞清楚说明是观察者,什么是被观察者 1.观察者相当于事件监听 2.被观察者相当于事件源和事件 /** * 观察者 */ public class Watcher implements Observer { /** * This method is ca 阅读全文
posted @ 2020-05-01 14:25 gaohuan30 阅读(292) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 下一页
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3