- 博客(56)
- 收藏
- 关注
原创 kmp算法
public static void main(String[] args) { String s = "ABCDABDEBBC ABCDAB ABCDABCDABDE"; String p = "ABCDABD"; System.out.println(match(s, p));}public static List<Integer> match(S...
2020-04-02 20:07:55
151
原创 单例模式的n种写法
单利模式模式1public class Singleton1 { private static Singleton1 singleton1; private Singleton1() { } //多线程不安全. public static Singleton1 getInstance() { if (singleton1 == ...
2020-03-07 18:06:54
224
原创 ReentrantLock的源码注解
package 源码注解;/* * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * *//* * * * * * * Written by Doug Lea with as...
2020-03-04 22:13:19
181
原创 redis的zset为什么用调表不用红黑树
跳表和红黑树的区别共同点:两者插入删除,删除,查找以及迭代输出时间复杂度红黑树和跳表的时间复杂度是一样的跳表在区间查询的时候效率是高于红黑树的,跳表进行查找O(logn)的时间复杂度定位到区间的起点,然后在原始链表往后遍历就可以了 ,其他插入和单个条件查询,更新两者的复杂度都是相同的O(logn)跳表的代码实现相对于红黑树更容易实现,跳表更加灵活,他可以通过改变索引构建策略,有效平衡执行...
2020-03-04 21:41:34
3493
1
原创 AQS注释
package com.java.lj;import sun.misc.Unsafe;import java.util.ArrayList;import java.util.Collection;import java.util.Date;import java.util.concurrent.TimeUnit;import AbstractOwnableSynchronizer;i...
2020-03-04 15:17:32
506
原创 滑动窗口计算最长不重复串
滑动窗口 a = "abcabcbcbba"首先有一个字符串我们用hashset来作为滑动窗口set<Character> slide =new HashSet();用一个i表示窗口头,j表示窗口尾巴max来记录最长窗口 ij a = "a b c a b c b c b b a" int n = s.length(); Set<Character>...
2020-02-24 16:06:44
223
原创 按层次遍历树结构
解法1package tree.leveltraversal;import tree.Node;import tree.myavl.BalanceTree;import java.util.LinkedList;import java.util.Queue;/** * Created by lijie35 on 2020-01-21 10:45 AM . */public ...
2020-01-21 14:42:07
301
原创 合并链表
package linkedlist;/** * Created by lijie35 on 2020-01-20 3:13 PM . */public class CombineList { public static void main(String[] args) { Node n1 = new Node(1); Node n3 = new ...
2020-01-20 15:50:28
105
原创 翻转树
package tree.reverseTree;import tree.Node;import tree.myavl.BalanceTree;/** * Created by lijie35 on 2020-01-20 2:15 PM . */public class ReverseTree { public static void main(String[] args)...
2020-01-20 15:00:25
239
原创 链表入口解法1
解法1不知道什么原理。我写着写着就出来了,测试过也没有问题,有知道原理的可以告诉我package linkedlist;/** * Created by lijie35 on 2020-01-20 10:43 AM . */public class ListEntrance { public static void main(String[] args) {// ...
2020-01-20 14:13:03
92
原创 链表找环的入口
package linkedlist;/** * Created by lijie35 on 2020-01-20 10:43 AM . */public class ListEntrance { public static void main(String[] args) { Node h1 = new Node(0); Node h2 = ne...
2020-01-20 11:35:08
148
原创 快慢指针判断链表成环的问题
package linkedlist;/** * Created by lijie35 on 2020-01-20 10:23 AM . */public class FastSlowPoint { public static void main(String[] args) { Node h1 = new Node(0); Node h2 = n...
2020-01-20 10:41:21
290
原创 斐波那契数列解法
递归写法,效率低package algorithm;/** * Created by lijie35 on 2020-01-19 3:21 PM . */public class Fibonacci { public static void main(String[] args) { System.out.println(fib(1)); } ...
2020-01-19 15:53:07
146
原创 二分查找
package sort;/** * Created by lijie35 on 2020-01-19 1:55 PM . */public class BinarySearch { public static void main( String[] args) { int[] arr = {1, 2, 3, 5, 6, 7,13,15...
2020-01-19 14:31:45
78
原创 翻转连表
package linkedlist;/** * Created by lijie35 on 2020-01-17 5:04 PM . */public class ReverseNode { public static void main(String[] args) { System.out.println(); Node node = ne...
2020-01-19 13:03:43
153
原创 归并排序
package sort;import java.util.Arrays;/** * Created by lijie35 on 2020-01-17 2:49 PM . */public class MergeSort { public static void main(String[] args) { // int arr[] = new int...
2020-01-17 16:37:42
57
原创 快排算法
package sort;import java.util.Arrays;/** * Created by lijie35 on 2020-01-17 12:31 PM . */public class Quicksort { public static void main(String[] args) { //int[] arr = {3, 45, 7,6,...
2020-01-17 14:43:46
95
原创 冒泡排序
package sort;import java.util.Arrays;public class BubblleSort { public static void main(String[] args) { int[] arr = {3, 45, 6, 8, 9, 2}; BubblleSort.sort(arr); } /**...
2020-01-17 11:59:07
165
原创 插入排序
package sort;import java.util.Arrays;/** * Created by lijie35 on 2020-01-17 11:21 AM . */public class InsertionSort { public static void main(String[] args) { int [] arr={3,45,6,8,9...
2020-01-17 11:45:47
64
原创 最小堆
就是最大堆的条件反过来package heap;import java.util.Arrays;public class SmallHeap { public static void main(String[] args) { SmallHeap smallHeap = new SmallHeap(); int[] a = new int[]{5,...
2020-01-17 10:35:52
73
原创 大堆顶实现
public class BigHeap2 { public static void main(String[] args) { BigHeap2 bigHeap2 = new BigHeap2(); int[] a = new int[]{5, 4, 3, 2, 1, 10, 20, 41, 15}; bigHeap2.sort(a);...
2020-01-17 10:27:50
187
原创 最小堆排序
package heap;import java.util.Arrays;public class SmallHeap { public static void main(String[] args) { SmallHeap smallHeap=new SmallHeap(); int[] a=new int[]{5,4,3,2,1,10,20,41...
2020-01-16 19:17:06
93
原创 大堆顶排序
package heap;import java.util.Arrays;/** * Created by lijie35 on 2020-01-16 3:49 PM . */public class BigHeap { public static void main(String[] args) { int[] arr = {3, 4, 23, ...
2020-01-16 18:56:01
169
原创 平衡二叉树的实现
``javapackage tree.myavl;import tree.Node;/**Created by lijie35 on 2020-01-15 6:37 PM .*/public class BalanceTree {private static final int LEFT = 0 ;private static final int RIGHT = 1 ;Nod...
2020-01-16 13:58:49
109
原创 JVM参数
XX:+ 启用选项-XX:-不启用选项-XX:=-XX:=堆设置-Xms :初始堆大小-Xmx :最大堆大小-Xmn:新生代大小。通常为 Xmx 的 1/3 或 1/4。新生代 = Eden + 2 个 Survivor 空间。实际可用空间为 = Eden + 1 个 Survivor,即 90%-XX:NewSize=n :设置年轻代大小-XX:NewRatio=n: 设置年轻...
2019-10-14 15:03:30
217
原创 nginx rewrite 学习
#nginx rewrite 学习来源文档 http://nginx.org/en/docs/http/ngx_http_rewrite_module.htmlbreak语法跳出rewriteSyntax: break;Default: —Context: server, location, ifif (condition){ limit_rate 10k; b...
2019-10-09 14:48:49
94
原创 nginx匹配规则
1.精确匹配命中即返回2.普通匹配,记录最长的匹配路径3.普通匹配完成进入正则匹配,命中第一个正则匹配,返回。要点:普通匹配无顺序,正则匹配有顺序...
2019-10-09 11:43:18
112
原创 nginx配置文件
源 https://www.nginx.com/resources/wiki/start/topics/examples/full/user www www; ## Default: nobodyworker_processes 5; ## Default: 1error_log logs/error.log;pid logs/nginx.pid;wor...
2019-10-08 11:51:39
117
原创 nginx配置相关
https://www.nginx.com/resources/wiki/start/topics/tutorials/commandline/
2019-10-08 11:37:07
66
转载 版本 3.1(最终版)
1Java™ Servlet 规范版本 3.1(最终版)Shing Wai Chan Rajiv Mordani [作者]穆茂强 张开涛 [译者]2012 年 6 月翻译2013 年 7 月修订Oracle 公司www.oracle.com2穆茂强的博客: http://blog.csdn.net/mhmyqn张开涛的博客: http://jinnianshilongnian....
2019-09-18 15:18:20
924
原创 动态代理
public interface Subject { void doSomething();}public class RealSubject implements Subject{ public void doSomething(){ //todo someting }}public class DynamicProxy implement...
2019-09-17 15:44:16
87
原创 代理模式
public interface Subject { void doSomething();}public class RealSubject implements Subject{ public void doSomething(){ //todo someting }}public class ProxyObject implements...
2019-09-17 15:35:06
85
原创 TypeHandlerRegistry 注册handler
age org.apache.ibatis.type;import java.io.InputStream;import java.io.Reader;import java.lang.reflect.Constructor;import java.lang.reflect.Modifier;import java.lang.reflect.Type;import java.math....
2019-09-17 15:02:12
1597
1
原创 TypeAliasRegistry 处理别名问题
package org.apache.ibatis.reflection.property;import java.lang.reflect.Field;/** * @author Clinton Begin */public final class PropertyCopier { private PropertyCopier() { // Prevent Inst...
2019-09-17 14:27:45
366
原创 PropertyNamer解析
package org.apache.ibatis.reflection.property;import java.util.Locale;import org.apache.ibatis.reflection.ReflectionException;/** * @author Clinton Begin */public final class PropertyNamer {...
2019-09-17 14:23:35
1616
原创 PropertyTokenizer解析
/** * Copyright 2009-2017 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the Lic...
2019-09-17 14:18:37
536
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人