随笔分类 -  JAVA的数据结构与算法

// 优先级队列 小案例
摘要:package queue;import java.util.Comparator;import java.util.PriorityQueue;import java.util.Queue ;import java.util.Random;// 优先级队列public class ProQuery 阅读全文
posted @ 2021-07-22 17:05 沐雨清晨 阅读(60) 评论(0) 推荐(0)
非阻塞之间的队列 的生产者和消费者
摘要:package queue;import java.util.PriorityQueue;// 非阻塞队列的生产者和消费者public class QueryTwo { public static void main(String[] args) { QueryTwo queryTwo = new 阅读全文
posted @ 2021-07-22 15:08 沐雨清晨 阅读(66) 评论(0) 推荐(0)
阻塞队列生产者消费
摘要:package queue;import sun.awt.CustomCursor;import java.util.concurrent.ArrayBlockingQueue;// 初始生产者和消费者public class BlockQuery { public static void main 阅读全文
posted @ 2021-07-22 11:30 沐雨清晨 阅读(32) 评论(0) 推荐(0)
初识栈
摘要:import java.util.Arrays;////Stack是一种后进先出(LIFO)的结构,其继承了Vector的基础上拓展5个方法push()、pop()、peek()、empty()、search()而来//// 1、push(E):将item推入到栈中//// 2、pop() :将栈中 阅读全文
posted @ 2021-07-21 16:39 沐雨清晨 阅读(71) 评论(0) 推荐(0)
希尔排序
摘要:int[] arr = {1, 52, 12, 36, 45,6,4,32,12,15,34,76}; // 希尔排序 shellSort(arr); // 希尔排序private static void shellSort(int[] arr) { if(arr==null||arr.length 阅读全文
posted @ 2021-07-13 15:04 沐雨清晨 阅读(31) 评论(0) 推荐(0)
插入排序
摘要:int[] arr = {1, 52, 12, 36, 45}; // 插入排序 insertSort(arr); //插入排序private static void insertSort(int[] arr) { if (arr == null || arr.length <= 1) { retu 阅读全文
posted @ 2021-07-13 11:22 沐雨清晨 阅读(33) 评论(0) 推荐(0)
选择排序
摘要:public static void main(String[] args) { int[] arr={1,52,12,36,45};// sorts(arr); choice(arr) ; } private static void choice(int[] arr) { if (arr==nul 阅读全文
posted @ 2021-07-12 17:45 沐雨清晨 阅读(33) 评论(0) 推荐(0)
冒泡排序
摘要:package one;import java.util.Arrays;public class Cone { public static void main(String[] args) { int[] arr={1,52,12,36,45}; sorts(arr); } public stati 阅读全文
posted @ 2021-07-12 17:11 沐雨清晨 阅读(43) 评论(0) 推荐(0)
归并排序--递归
摘要:直接看代码 package com.lm.digui; public class GuiBinSort { public static void main(String[] args) { int[] arr = {1, 2, 3, 5, 8}; System.out.println(guibinN 阅读全文
posted @ 2020-01-05 22:45 沐雨清晨 阅读(104) 评论(0) 推荐(0)
运用递归进行二分查找
摘要:package com.lm.digui; import java.util.Arrays; public class MergonQuery { public static void main(String[] args) { int merget[] = {2, 5, 39, 2, 2, 4, 阅读全文
posted @ 2020-01-05 22:44 沐雨清晨 阅读(173) 评论(0) 推荐(0)
递归实现变位数 (就是出现那些可能性)
摘要:变为数 说白了 把出现的可能 都现实出来 直接代码 package com.lm.digui; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * 变位数 阅读全文
posted @ 2020-01-05 22:43 沐雨清晨 阅读(277) 评论(0) 推荐(0)
递归与尾递归
摘要:递归就是自己调自己 public class NumberDG { public static void main(String[] args) { System.out.println(addNumber(5)); System.out.println(cfNumber(5)); System.o 阅读全文
posted @ 2020-01-05 22:40 沐雨清晨 阅读(194) 评论(0) 推荐(0)