<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[种一棵树最好的时间是十年前，其次是现在。]]></title><description><![CDATA[]]></description><link>https://blog.csdn.net/xcrazyu</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; xcrazyu]]></copyright><item><title><![CDATA[dfs和bfs]]></title><link>https://blog.csdn.net/xcrazyu/article/details/106749519</link><guid>https://blog.csdn.net/xcrazyu/article/details/106749519</guid><author>xcrazyu</author><pubDate>Sun, 14 Jun 2020 18:16:42 +0800</pubDate><description><![CDATA[地上有一个m行和n列的方格。一个机器人从坐标0,0的格子开始移动，每一次只能向左，右，上，下四个方向移动一格，但是不能进入行坐标和列坐标的数位之和大于k的格子。 例如，当k为18时，机器人能够进入方格（35,37），因为3+5+3+7 = 18。但是，它不能进入方格（35,38），因为3+5+3+8 = 19。请问该机器人能够达到多少个格子？


import java.util.concurrent.*;
import java.util.*;
public class Solution {
    in]]></description><category></category></item><item><title><![CDATA[理解根目录，getClass().getResourceAsStream和getClass().getClassLoader().getResourceAsStream的区别]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102914569</link><guid>https://blog.csdn.net/xcrazyu/article/details/102914569</guid><author>xcrazyu</author><pubDate>Tue, 05 Nov 2019 14:10:20 +0800</pubDate><description><![CDATA[web项目中 ，编译好的.class文件，xml、properties等配置文件都在WEB-INF/classes目录下。

也就是编译后的根目录。

getClass().getClassLoader().getResourceAsStream ，通过类加载器可以直接定位到根目录下。（因为双亲委派机制）

getClass().getResourceAsStream 则是定位到当前类的平级。（...]]></description><category></category></item><item><title><![CDATA[实现轻量java web框架]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102914202</link><guid>https://blog.csdn.net/xcrazyu/article/details/102914202</guid><author>xcrazyu</author><pubDate>Tue, 05 Nov 2019 14:00:43 +0800</pubDate><description><![CDATA[思路：

Spring

Ioc：

 实现注解： @MyRepository @Service @Controller @Bean @Configuration @ComponentScan @MyAutowired @MyValue

 实现了用注解、配置类、xml 注册bean

1、ApplicationContextBuilder.build( InputSt...]]></description><category></category></item><item><title><![CDATA[java中properties配置文件的用法]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102875384</link><guid>https://blog.csdn.net/xcrazyu/article/details/102875384</guid><author>xcrazyu</author><pubDate>Sat, 02 Nov 2019 19:10:57 +0800</pubDate><description><![CDATA[1、实例化properties类（java.util.Properties）


Properties prop = new Properties();

2、利用Properties中的load()方法加载配置文件


prop.load(DBUtil.class.getResourceAsStream("/jdbc.properties"));

或：


xx.getClass().getC...]]></description><category></category></item><item><title><![CDATA[实现jdk动态代理和CGLIB动态代理]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102821129</link><guid>https://blog.csdn.net/xcrazyu/article/details/102821129</guid><author>xcrazyu</author><pubDate>Wed, 30 Oct 2019 16:13:05 +0800</pubDate><description><![CDATA[JDK自带方法

首先介绍一下最核心的一个接口和一个方法：

首先是java.lang.reflect包里的InvocationHandler接口：


public interface InvocationHandler {
    public Object invoke(Object proxy, Method method, Object[] args)
        throws Th...]]></description><category></category></item><item><title><![CDATA[图（java实现）]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102740929</link><guid>https://blog.csdn.net/xcrazyu/article/details/102740929</guid><author>xcrazyu</author><pubDate>Fri, 25 Oct 2019 20:22:17 +0800</pubDate><description><![CDATA[一、图的表示方式



1、邻接矩阵



如果是带权图，将1换成权值。

2、邻接表



表示与1 关联的有 1，2，3，4

二、图的实现。

图：


    /**
     * 图。
     * notes：所有的节点。
     * edges：所有的边。
     */
    static class Graph {
        HashMap&lt;Integer, ...]]></description><category></category></item><item><title><![CDATA[暴力递归与动态规划]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102708450</link><guid>https://blog.csdn.net/xcrazyu/article/details/102708450</guid><author>xcrazyu</author><pubDate>Thu, 24 Oct 2019 11:23:40 +0800</pubDate><description><![CDATA[1、汉诺塔问题。打印n层汉诺塔从最左边移动到最右边的全部过程。


    public static void main(String[] args) {
        method(3, "左", "右", "中");
    }

    public static void method(int n, String from, String to, String help) {
    ...]]></description><category></category></item><item><title><![CDATA[贪心算法实例]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102690658</link><guid>https://blog.csdn.net/xcrazyu/article/details/102690658</guid><author>xcrazyu</author><pubDate>Tue, 22 Oct 2019 21:11:19 +0800</pubDate><description><![CDATA[贪心算法（又称贪婪算法）是指，在对问题求解时，总是做出在当前看来是最好的选择。也就是说，不从整体最优上加以考虑，他所做出的是在某种意义上的局部最优解。

贪心算法不是对所有问题都能得到整体最优解，关键是贪心策略的选择，选择的贪心策略必须具备无后效性，即某个状态以前的过程不会影响以后的状态，只与当前状态有关。[1]

----------------------------------------...]]></description><category></category></item><item><title><![CDATA[前缀树（java实现）经典例题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102690138</link><guid>https://blog.csdn.net/xcrazyu/article/details/102690138</guid><author>xcrazyu</author><pubDate>Tue, 22 Oct 2019 20:53:45 +0800</pubDate><description><![CDATA[Trie树，又叫字典树、前缀树（Prefix Tree）、单词查找树或键树，是一种多叉树结构。如下图：


上图是一棵Trie树，表示了关键字集合{“a”, “to”, “tea”, “ted”, “ten”, “i”, “in”, “inn”} 。从上图可以归纳出Trie树的基本性质：①根节点不包含字符，除根节点外的每一个子节点都包含一个字符。
②从根节点到某一个节点，路径上经过的字符连接起来，...]]></description><category></category></item><item><title><![CDATA[java实现并查集]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102688508</link><guid>https://blog.csdn.net/xcrazyu/article/details/102688508</guid><author>xcrazyu</author><pubDate>Tue, 22 Oct 2019 19:05:35 +0800</pubDate><description><![CDATA[在计算机科学中，并查集是一种树型的数据结构，用于处理一些不交集（Disjoint Sets）的合并及查询问题。有一个联合-查找算法（union-find algorithm）定义了两个用于此数据结构的操作：

Find：确定元素属于哪一个子集。它可以被用来确定两个元素是否属于同一子集。
	Union：将两个子集合并成同一个集合。
                 ...]]></description><category></category></item><item><title><![CDATA[小岛问题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102687813</link><guid>https://blog.csdn.net/xcrazyu/article/details/102687813</guid><author>xcrazyu</author><pubDate>Tue, 22 Oct 2019 18:16:02 +0800</pubDate><description><![CDATA[题目：


一个矩阵中只有0和1两种值，每个位置都可以和自己的上、下、左、右四个位置相连，
如果有一片1连在一起，这个部分叫做一个岛，求一个矩阵中有多少个岛？
举例：
0 0 1 0 1 0
1 1 1 0 1 0
1 0 0 1 0 0
0 0 0 0 0 0
这个矩阵中有三个岛。

分析：

1、将数据存到二维数组中，遍历数组，当前值为1时，岛计数加一，将当前值写为2，并将当前于之相连的1值...]]></description><category></category></item><item><title><![CDATA[满二叉树，完全二叉树，平衡二叉树，二叉搜索树（二叉查找树)]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102657800</link><guid>https://blog.csdn.net/xcrazyu/article/details/102657800</guid><author>xcrazyu</author><pubDate>Mon, 21 Oct 2019 09:50:46 +0800</pubDate><description><![CDATA[二叉树： 每个结点不超过2个子树的树结构。

满二叉树：一个结点要么是叶子节点，要么有两个叶子结点。（国内教程定义：一个二叉树，如果每一个层的结点数都达到最大值，则这个二叉树就是满二叉树）

完全二叉树：深度为h，除h层外，h-1层是满二叉树，h层结点连续集中在左边。(若设二叉树的深度为h，除第 h 层外，其它各层 (1～h-1) 的结点数都达到最大个数，第 h 层所有的结点都连续集中在最左边，这...]]></description><category></category></item><item><title><![CDATA[二叉树经典例题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102614539</link><guid>https://blog.csdn.net/xcrazyu/article/details/102614539</guid><author>xcrazyu</author><pubDate>Fri, 18 Oct 2019 13:32:31 +0800</pubDate><description><![CDATA[二叉树：


    static class Node {
        private int data;
        private Node left;
        private Node right;

        public Node() {

        }

        public Node(int data) {
            this.da...]]></description><category></category></item><item><title><![CDATA[链表经典例题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102585329</link><guid>https://blog.csdn.net/xcrazyu/article/details/102585329</guid><author>xcrazyu</author><pubDate>Wed, 16 Oct 2019 15:08:48 +0800</pubDate><description><![CDATA[单向链表：


class Node {
        private int data;
        private Node next;

        public Node(int data) {
            this.data = data;
        }


        public int getData() {
            return d...]]></description><category></category></item><item><title><![CDATA[矩阵经典例题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102573368</link><guid>https://blog.csdn.net/xcrazyu/article/details/102573368</guid><author>xcrazyu</author><pubDate>Tue, 15 Oct 2019 19:41:41 +0800</pubDate><description><![CDATA[一、顺时针打印矩阵

宏观的将整个矩阵看作是一个套一个的方框 ，找到对角线上两个点的坐标，遍历每一个方框。


    public static void method(int[][] arr) {
        method2(arr, 0, 0,  arr.length - 1, arr[0].length - 1);
    }

    public static void metho...]]></description><category></category></item><item><title><![CDATA[栈与队列]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102571591</link><guid>https://blog.csdn.net/xcrazyu/article/details/102571591</guid><author>xcrazyu</author><pubDate>Tue, 15 Oct 2019 17:43:28 +0800</pubDate><description><![CDATA[数组模拟队列：


    static class queue1 {
        private int[] arr;
        private int first = 0;
        private int end = 0;

        public void add(int num) {
            if (end &gt;= arr.length) {
 ...]]></description><category></category></item><item><title><![CDATA[数组相邻两数最大差值]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102570042</link><guid>https://blog.csdn.net/xcrazyu/article/details/102570042</guid><author>xcrazyu</author><pubDate>Tue, 15 Oct 2019 16:49:04 +0800</pubDate><description><![CDATA[给定一个数组，求排序之后，相邻两数的最大差值，要求时间复杂度O(N)，且要求不能用非基于比较的排序。

思路：因为要求时间复杂度为O（n）且不能用非比较排序，常用的比较排序很难做到O（n）。这里是借助n+1个桶，将n个数平均分配到n个桶里，所以我们所求的最大差值肯定不在一个桶内（只有一个数另说），然后依次求出当前桶最小值与前一个非空桶最大值的差值，求出最大的差值就是我们要的结果。


    st...]]></description><category></category></item><item><title><![CDATA[荷兰国旗问题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102568232</link><guid>https://blog.csdn.net/xcrazyu/article/details/102568232</guid><author>xcrazyu</author><pubDate>Tue, 15 Oct 2019 15:41:31 +0800</pubDate><description><![CDATA[一、给定一个数组arr，和一个数num，请把小于等于num的数放在数组的左边，大于num的数放在数组的右边。要求额外空间复杂度O(1)，时间复杂度O(N)


    public void method(int[] arr, int num) {
        int index = 0;
        for (int i = 0; i &lt; arr.length; i++) {
  ...]]></description><category></category></item><item><title><![CDATA[小和问题]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102567172</link><guid>https://blog.csdn.net/xcrazyu/article/details/102567172</guid><author>xcrazyu</author><pubDate>Tue, 15 Oct 2019 15:09:43 +0800</pubDate><description><![CDATA[一、最简单的就是遍历一遍算出小和

二、通过归并的方法

利用归并排序，分治 后用外排进行合并时同时求出这两段产生的小和。时间复杂度为n*logn


public static int littleSum(int[] arr) {
        return mergeSort(arr, 0, arr.length - 1);
    }

    private static ...]]></description><category></category></item><item><title><![CDATA[java排序算法]]></title><link>https://blog.csdn.net/xcrazyu/article/details/102526605</link><guid>https://blog.csdn.net/xcrazyu/article/details/102526605</guid><author>xcrazyu</author><pubDate>Mon, 14 Oct 2019 15:14:26 +0800</pubDate><description><![CDATA[数组中两个数交换位置：


	public static void swap(int[] arr, int a, int b){
		int temp = arr[a];
		arr[a] = arr[b];
		arr[b] = temp;
	}


一、基于比较的排序

1、冒泡排序


	public static void bubbleSort(int[] arr){
		if(arr =...]]></description><category></category></item></channel></rss>