<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[That]]></title><description><![CDATA[Code & Communication]]></description><link>https://blog.youkuaiyun.com/that163</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; that163]]></copyright><item><title><![CDATA[递归与迭代]]></title><link>https://blog.youkuaiyun.com/that163/article/details/9850039</link><guid>https://blog.youkuaiyun.com/that163/article/details/9850039</guid><author>that163</author><pubDate>Fri, 09 Aug 2013 10:43:53 +0800</pubDate><description><![CDATA[在我接受到的教育中，递归似乎是一个很神秘的东西。它难以说清，是高级货，像一团迷雾。在高中课外学习的过程中，我一开始没有理解到什么是递归，老师也可能觉得我们比较难以理解，所以后来就没有统一说说。而我也觉得貌似挺难的，也貌似不用也可以，所以就没了回事。后来到了大学，教编程语言的老师居然极度忽视递归，那时的我已经知道递归的重要性，她竟然说了些站不住脚的观点就糊弄过去，说白了，很多都是语法糖衣。]]></description><category></category></item><item><title><![CDATA[线段树_单点更新]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8249482</link><guid>https://blog.youkuaiyun.com/that163/article/details/8249482</guid><author>that163</author><pubDate>Tue, 04 Dec 2012 18:38:19 +0800</pubDate><description><![CDATA[最近开始接触线段树的内容，我发现线段树非常灵活和强大，很多问题都可以用线段树来做。但是，对于初次接触的人来说，可能比较难。根据大牛的博客，我开始一步步练习。现在把已经做好的单点更新的习题贴出来，讲讲自己的想法。欢迎拍砖~


补充几点说明：
（1）我采用静态方法构建线段树，即用数组来做，左子树为 2*i，右子树为 2*i+1。按照保守估计，数组空间一般开Ｎ*4，用到的空间实质上是Ｎ*2-1]]></description><category></category></item><item><title><![CDATA[ZOJ 1649.Rescue]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8094052</link><guid>https://blog.youkuaiyun.com/that163/article/details/8094052</guid><author>that163</author><pubDate>Sat, 20 Oct 2012 22:23:55 +0800</pubDate><description><![CDATA[需要在监狱里营救出天使，监狱里有若干个狱卒，干掉狱卒需要消耗1回合。特别注意营救者可能不止一个。
因为干掉狱卒需要多消耗1回合，所以用简单的队列出来的不一定就是最优结果，所以要用到优先队列。
BFS与优先队列的应用。
#include
#include
#include
using namespace std;
int **Prison;
int n,m;
int move[4][2] =]]></description><category></category></item><item><title><![CDATA[ZOJ 1438.Asteroids!]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8094023</link><guid>https://blog.youkuaiyun.com/that163/article/details/8094023</guid><author>that163</author><pubDate>Sat, 20 Oct 2012 22:12:29 +0800</pubDate><description><![CDATA[三维迷宫，简单BFS


#include
#include
#include
using namespace std;
struct Point{
    int x;
    int y;
    int z;
    int steps;
}start,end;             //起点与终点
int n;                  //层数
char ***space]]></description><category></category></item><item><title><![CDATA[ZOJ 1406.Jungle Roads]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8093996</link><guid>https://blog.youkuaiyun.com/that163/article/details/8093996</guid><author>that163</author><pubDate>Sat, 20 Oct 2012 22:08:59 +0800</pubDate><description><![CDATA[给出所有村庄的所有通路，找出一条连接所有村庄花费最小的通路。
最小生成树的应用。此处用的是Prim算法。
#include
#include
using namespace std;
struct Graph{
    //图邻接矩阵
    char data;
    int key;
    int *adjacency;
}*G;
int n;          //村庄数量
int]]></description><category></category></item><item><title><![CDATA[ZOJ 1204.Additive equations]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8093978</link><guid>https://blog.youkuaiyun.com/that163/article/details/8093978</guid><author>that163</author><pubDate>Sat, 20 Oct 2012 21:59:01 +0800</pubDate><description><![CDATA[给出一个整数集合，判断是否能用集合里的元素构造加法等式，若能则输出按顺序输出所有等式。
简单DFS()应用。
/*
ZOJ 1204 Additive equations
Sample Input
3
3 1 2 3
3 1 2 5
6 1 2 3 5 4 6

Output for the Sample Input
1+2=3

Can't find any equations.

1+2=]]></description><category></category></item><item><title><![CDATA[ZOJ 1091.Knight Moves]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8093971</link><guid>https://blog.youkuaiyun.com/that163/article/details/8093971</guid><author>that163</author><pubDate>Sat, 20 Oct 2012 21:52:26 +0800</pubDate><description><![CDATA[国际象棋的马移动，分别向八个方向作广度优先搜索，找到最小步数。
BFS()简单应用。
#include
#include
#include
using namespace std;
struct Point{
    //点
    int x;
    int y;
};
struct QP{
    //从开始到这点所需步数
    Point p;
    int move;
};
bo]]></description><category></category></item><item><title><![CDATA[经典迷宫问题DFS]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8069780</link><guid>https://blog.youkuaiyun.com/that163/article/details/8069780</guid><author>that163</author><pubDate>Sun, 14 Oct 2012 14:53:00 +0800</pubDate><description><![CDATA[给定一个迷宫，入口为左上角，出口为右下角，问是否有路径从入口到出口，若有则输出一条这样的路径。注意移动可以从上、下、左、右、上左、上右、下左、下右八个方向进行。迷宫输入0表示可走，输入1表示墙。易得可以用1将迷宫围起来避免边界问题。
本题采用DFS算法给出解。
/*
迷宫问题（八方向）
input:
1
6 8
0 1 1 1 0 1 1 1
1 0 1 0 1 0 1 0
0 1 0 0 1]]></description><category></category></item><item><title><![CDATA[经典迷宫问题BFS]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8069764</link><guid>https://blog.youkuaiyun.com/that163/article/details/8069764</guid><author>that163</author><pubDate>Sun, 14 Oct 2012 14:49:47 +0800</pubDate><description><![CDATA[给定一个迷宫，入口为左上角，出口为右下角，问是否有路径从入口到出口，若有则输出一条这样的路径。注意移动可以从上、下、左、右、上左、上右、下左、下右八个方向进行。迷宫输入0表示可走，输入1表示墙。易得可以用1将迷宫围起来避免边界问题。
本题采用BFS算法给出解。注意，利用BFS算法给出的路径必然是一条最短路径。
/*
迷宫问题（八方向）
input:
1
6 8
0 1 1 1 0 1 1 1]]></description><category></category></item><item><title><![CDATA[广度优先搜索BFS——图邻接矩阵表示]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8045317</link><guid>https://blog.youkuaiyun.com/that163/article/details/8045317</guid><author>that163</author><pubDate>Sun, 07 Oct 2012 15:22:44 +0800</pubDate><description><![CDATA[这个是基于邻接矩阵的BFS图算法。
/*
图邻接矩阵表示DFS
input:
1
7
A 0 0 0 0 1 0 0
B 0 0 1 1 0 0 0
C 0 1 0 1 0 0 0
D 0 1 0 0 1 1 0
E 1 0 0 1 0 0 1
F 0 0 0 1 0 0 0
G 0 0 0 0 1 0 0
output:
A E D G B F C
*/
#include
#include
#]]></description><category></category></item><item><title><![CDATA[广度优先搜索BFS——图邻接表表示]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8045313</link><guid>https://blog.youkuaiyun.com/that163/article/details/8045313</guid><author>that163</author><pubDate>Sun, 07 Oct 2012 15:21:20 +0800</pubDate><description><![CDATA[BFS是图的另一个重要算法，下面是基于邻接表表示的BFS算法。
/*
图邻接表表示BFS
input:
1
7
A 1 5
B 2 4 3
C 2 4 2
D 3 6 5 2
E 3 7 4 1
F 1 4
G 1 5
output:
A E D G B F C
*/
#include
#include
#include
using namespace std;
struct LinkNode{]]></description><category></category></item><item><title><![CDATA[深度优先搜索DFS——图邻接矩阵表示]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8045003</link><guid>https://blog.youkuaiyun.com/that163/article/details/8045003</guid><author>that163</author><pubDate>Sun, 07 Oct 2012 12:44:00 +0800</pubDate><description><![CDATA[同样的DFS，这个是用邻接矩阵保存的图，或许应用没有那么广，要浪费较多的空间，但是还是有必要实现一下的，和之前那个算法的思想是一样的，只是变换了存储结构。
/*
图邻接矩阵表示DFS
input:
1
7
A 0 0 0 0 1 0 0
B 0 0 1 1 0 0 0
C 0 1 0 1 0 0 0
D 0 1 0 0 1 1 0
E 1 0 0 1 0 0 1
F 0 0 0 1 0 0 0]]></description><category></category></item><item><title><![CDATA[深度优先搜索DFS——图邻接表表示]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8044986</link><guid>https://blog.youkuaiyun.com/that163/article/details/8044986</guid><author>that163</author><pubDate>Sun, 07 Oct 2012 12:26:10 +0800</pubDate><description><![CDATA[作为图的一个基本算法，DFS应用很广，可以推广出很多实用的算法。下面贴出一个比较常用的用邻接表表示的图DFS。

/*
图邻接表表示DFS
input:
1
7
A 1 5
B 2 4 3
C 2 4 2
D 3 6 5 2
E 3 7 4 1
F 1 4
G 1 5
output:
A E D B C F G（运用递归实现）
A E G D F B C（运用栈实现]]></description><category></category></item><item><title><![CDATA[二叉树层次遍历]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8040256</link><guid>https://blog.youkuaiyun.com/that163/article/details/8040256</guid><author>that163</author><pubDate>Thu, 04 Oct 2012 21:05:32 +0800</pubDate><description><![CDATA[/*
二叉树的层次遍历
input:
2
10 5 4 -1 -1 -1 20 19 -1 -1 40 -1 -1
30 10 8 20 -1 -1 -1 -1 50 40 -1 45 -1 -1 -1
output:
10 5 20 4 19 40
30 10 50 8 40 20 45
*/
#include
#include
using namespace std;
struct BTree]]></description><category></category></item><item><title><![CDATA[二叉树后序遍历]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8040011</link><guid>https://blog.youkuaiyun.com/that163/article/details/8040011</guid><author>that163</author><pubDate>Thu, 04 Oct 2012 18:52:55 +0800</pubDate><description><![CDATA[分别用了三种不同的方法实现了二叉树的后序遍历。
/*
input:
2
10 5 4 -1 -1 -1 20 19 -1 -1 40 -1 -1
30 10 8 20 -1 -1 -1 -1 50 40 -1 45 -1 -1 -1
output:
4 5 19 40 20 10
20 8 10 45 40 50 30
*/
#include
#include
using namespace s]]></description><category></category></item><item><title><![CDATA[二叉树中序遍历]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8040009</link><guid>https://blog.youkuaiyun.com/that163/article/details/8040009</guid><author>that163</author><pubDate>Thu, 04 Oct 2012 18:51:59 +0800</pubDate><description><![CDATA[分别用了三种不同的方法实现了二叉树的中序遍历。
/*
input:
2
10 5 4 -1 -1 -1 20 19 -1 -1 40 -1 -1
30 10 8 20 -1 -1 -1 -1 50 40 -1 45 -1 -1 -1
output:
4 5 10 19 20 40
20 8 10 30 40 45 50
*/
#include
#include
using namespace s]]></description><category></category></item><item><title><![CDATA[二叉树前序遍历]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8040004</link><guid>https://blog.youkuaiyun.com/that163/article/details/8040004</guid><author>that163</author><pubDate>Thu, 04 Oct 2012 18:50:15 +0800</pubDate><description><![CDATA[分别用了三种不同的方法实现了二叉树的前序遍历。
#include
#include
using namespace std;
struct BTreeNode{
    //二叉树
    int data;
    BTreeNode *lchild;
    BTreeNode *rchild;
    BTreeNode *parent;
};
/*
void PreOrder(BTree]]></description><category></category></item><item><title><![CDATA[二叉搜索树]]></title><link>https://blog.youkuaiyun.com/that163/article/details/8038682</link><guid>https://blog.youkuaiyun.com/that163/article/details/8038682</guid><author>that163</author><pubDate>Wed, 03 Oct 2012 21:35:21 +0800</pubDate><description><![CDATA[之前在学二叉搜索树的相关知识，今天我自己把有讲的没讲的都实现了一遍，的确有点收获~

#include
using namespace std;
struct BTreeNode{
    //二叉搜索树
    int data;
    BTreeNode *parent;
    BTreeNode *lchild;
    BTreeNode *rchild;
};]]></description><category></category></item><item><title><![CDATA[一个眼神]]></title><link>https://blog.youkuaiyun.com/that163/article/details/7725432</link><guid>https://blog.youkuaiyun.com/that163/article/details/7725432</guid><author>that163</author><pubDate>Sat, 07 Jul 2012 22:12:31 +0800</pubDate><description><![CDATA[我现在还记得前两天搭地铁的时候，那个同龄人的眼神。

       那是一个外地人，二十多岁，估计是和父母一起来到广州这打工。头发白白的，那只是灰；手黑黑的，那只是脏；面容不算特别地有神，那只是累。地铁还是一贯拥挤，我恰巧就站在他前面。或许是年龄相近的缘故，我们互相打量着对方，然后我发觉他怔怔地看着我，我不自觉也看着他。我从他的眼神里看出了一些东西，有疑惑，有迷茫，有羡慕，还有一些我看不懂的。]]></description><category></category></item><item><title><![CDATA[比赛+项目==大学？]]></title><link>https://blog.youkuaiyun.com/that163/article/details/7632714</link><guid>https://blog.youkuaiyun.com/that163/article/details/7632714</guid><author>that163</author><pubDate>Tue, 05 Jun 2012 00:10:48 +0800</pubDate><description><![CDATA[上周体育老师说：“下周要考试了！”我才想起，原来这么快就到16周了，这个学期又差不多过去了。太快了，我有种错觉好像才刚刚开始呢！最近都貌似很忙，忙到没有时间停下来思考了（好吧...我承认我一直在想些有的没的）。
 
 
       最近的一段时间，一直充斥着各种比赛。最高记录是两周五场ACM选拔赛（也就是接近20小时），估计我是比怕了，所以就好好想一想，这其实有没有必要。说实话，我不是那种]]></description><category></category></item></channel></rss>