05 2022 档案
滑动窗口
摘要:https://leetcode.cn/problems/find-all-anagrams-in-a-string/solution/hua-dong-chuang-kou-tong-yong-si-xiang-jie-jue-zi-/ 阅读全文
posted @ 2022-05-31 22:16 upupup-999 阅读(9) 评论(0) 推荐(0) 编辑
对象序列化
摘要:1.对象实现Serializable接口 2.将对象通过对象输出流输出,在反序列 public Object getClone() throws IOException, ClassNotFoundException { ByteArrayOutputStream bio = new ByteArr 阅读全文
posted @ 2022-05-10 22:06 upupup-999 阅读(22) 评论(0) 推荐(0) 编辑
指令重排案例
摘要:package thread; public class ResortDemo { static int i = 0; static boolean f = false; public static void main(String[] args) { new Thread(() -> { try 阅读全文
posted @ 2022-05-07 13:33 upupup-999 阅读(74) 评论(0) 推荐(0) 编辑
6.堆排序(不稳定)
摘要:package com.wang.principle; public class Test2 { public static void main(String[] args) { int[] arr = {49, 38, 65, 97, 76, 13, 27, 50}; //int[] c = { 阅读全文
posted @ 2022-05-04 13:10 upupup-999 阅读(65) 评论(0) 推荐(0) 编辑
5.快排(不稳定)
摘要:public static int Partition(int[] nums,int left,int right){ int prvot=nums[left]; while (left<right) { while (left<right&&nums[right]>=nums[left])righ 阅读全文
posted @ 2022-05-04 13:07 upupup-999 阅读(38) 评论(0) 推荐(0) 编辑
4.归并排序(稳定)
摘要:public static void main(String[] args) { int[] arr = {49, 38, 65, 97, 76, 13, 27, 50}; //int[] c = { 13, 38, 65, 97, 76, 13, 2, 50 };//稳定性判断 rec(arr,0 阅读全文
posted @ 2022-05-04 13:03 upupup-999 阅读(37) 评论(0) 推荐(0) 编辑
3.插入排序
摘要:/** * 插入排序 */ public static void insertSort(int[] arr) { int length = arr.length; for (int i = 1; i < length; i++) {//从第2个数字开始 for (int j = i - 1; j > 阅读全文
posted @ 2022-05-04 12:58 upupup-999 阅读(21) 评论(0) 推荐(0) 编辑
借鉴博客
摘要:https://zhuanlan.zhihu.com/p/488355404 阅读全文
posted @ 2022-05-04 12:32 upupup-999 阅读(7) 评论(0) 推荐(0) 编辑
2.冒泡排序(稳定)
摘要:/** * 冒泡排序 */ public static void bubbleSort(int[] arr) { int length = arr.length; for (int i = 1; i < length; i++) {//比较趟数为数据量-1 for (int j = 0; j < l 阅读全文
posted @ 2022-05-04 12:15 upupup-999 阅读(29) 评论(0) 推荐(0) 编辑
1.选择排序(不稳定)
摘要:package com.wang.principle; public class Tets1 { /** * 选择排序 */ public static void selectionSort(int[] a) { int length=a.length; for(int i=0;i<length;i 阅读全文
posted @ 2022-05-04 11:50 upupup-999 阅读(54) 评论(0) 推荐(0) 编辑
复杂度
摘要: 阅读全文
posted @ 2022-05-04 11:12 upupup-999 阅读(10) 评论(0) 推荐(0) 编辑




点击右上角即可分享
微信分享提示