<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[notishell的专栏]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/notishell</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; notishell]]></copyright><item><title><![CDATA[Java注解成员支持的类型]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/53992080</link><guid>https://blog.youkuaiyun.com/notishell/article/details/53992080</guid><author>notishell</author><pubDate>Tue, 03 Jan 2017 10:20:18 +0800</pubDate><description><![CDATA[在Java中，注解的成员类型是有限的，例如下面的示例：@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface Target {
    /**
     * Returns an array of the kinds of elements an an]]></description><category></category></item><item><title><![CDATA[妹纸小A的计数工作]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/53991575</link><guid>https://blog.youkuaiyun.com/notishell/article/details/53991575</guid><author>notishell</author><pubDate>Tue, 03 Jan 2017 09:41:09 +0800</pubDate><description><![CDATA[欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来，用它写博客，将会带来全新的体验哦：
Markdown和扩展Markdown简洁的语法
代码块高亮
图片链接和图片上传
LaTex数学公式
UML序列图和流程图
离线写博客
导入导出Markdown文件
丰富的快捷键
快捷键
加粗    Ctrl + B 
斜体    Ctrl + I 
引用    Ctrl]]></description><category></category></item><item><title><![CDATA[TCP状态转换图]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/11836319</link><guid>https://blog.youkuaiyun.com/notishell/article/details/11836319</guid><author>notishell</author><pubDate>Thu, 19 Sep 2013 23:25:06 +0800</pubDate><description><![CDATA[+---------+ ---------\      active OPEN  
                              |  CLOSED |            \    -----------  
                              +---------+<---------\   \   create TCB  
              ]]></description><category></category></item><item><title><![CDATA[填充Z形二维数组]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/11749793</link><guid>https://blog.youkuaiyun.com/notishell/article/details/11749793</guid><author>notishell</author><pubDate>Mon, 16 Sep 2013 23:14:39 +0800</pubDate><description><![CDATA[形如




 1  
 3
4
10


 2
 5
9
11


 6
 8
12
15


 7
13
14
16



的数组称谓Z形二维数组。填充这样的数组其实只要按照Z形进行行走填充即可，设置一个flag指示方向，行走的时候检测边界，遇到边界便转换方向。

const int N = 16;

void fill_z_ar]]></description><category></category></item><item><title><![CDATA[非递归实现快速排序]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/11701197</link><guid>https://blog.youkuaiyun.com/notishell/article/details/11701197</guid><author>notishell</author><pubDate>Sun, 15 Sep 2013 09:37:29 +0800</pubDate><description><![CDATA[非递归实现快速排序的方法和递归类似，其实所有的递归程序都能写成非递归的形式，只要将隐式的栈改成显示的栈即可。

void swap(int &in1, int &in2)
{
	int tmp = in1;
	in1 = in2;
	in2 = tmp;
}

int qsort_partition(int A[], int q, int r)
{
	int i, j, k = A[r];
	]]></description><category></category></item><item><title><![CDATA[寻找发帖“水王”]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/11117553</link><guid>https://blog.youkuaiyun.com/notishell/article/details/11117553</guid><author>notishell</author><pubDate>Thu, 05 Sep 2013 12:20:56 +0800</pubDate><description><![CDATA[在编程之美中有《寻找发帖“水王”》这么一题，这题书上提供了一个比较好的解法。对于某个元素超过总数N的1/M这类问题有一个通用的方法来解决。试看这样的操作：每次取出M个不同的元素，然后求解余下元素中超过总数1/M的元素。最终将能剩下M-1个元素，超过总数的1/M的元素肯定在其中，计算一下这些元素的数量即可得到解。总的时间复杂度最少能达到O(NMlogM)，下面代码实现了这个思路。#include 
]]></description><category></category></item><item><title><![CDATA[连连看游戏中的最短路径]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/11099127</link><guid>https://blog.youkuaiyun.com/notishell/article/details/11099127</guid><author>notishell</author><pubDate>Wed, 04 Sep 2013 23:03:02 +0800</pubDate><description><![CDATA[连连看游戏是一个比较简单的游戏，两个相同的点可以消除，但前提是两点之间的路径不能有多于两个折点。如何去求解两个点之间的距离呢？我们可以将这里的距离定义为二元组（x，y），x表示多少次转折，y表示路径长度。x值越小距离越短，相同x值的情况下y值越小距离越短。这样下面就容易写代码了。
#include 
#include 
using namespace std;

const int N = 20]]></description><category></category></item><item><title><![CDATA[快速排序]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/10858749</link><guid>https://blog.youkuaiyun.com/notishell/article/details/10858749</guid><author>notishell</author><pubDate>Sun, 01 Sep 2013 22:37:50 +0800</pubDate><description><![CDATA[快速排序的python实现。
# -*- coding:utf-8 -*-
'''
qsort
'''

def qsort_partition(A,p,r):
    x = A[r]
    i = p - 1
    for j in range(p,r):
        if A[j] < x:
            i += 1
            A[j],A[i] = A[]]></description><category></category></item><item><title><![CDATA[和为指定值的连续序列]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/10693859</link><guid>https://blog.youkuaiyun.com/notishell/article/details/10693859</guid><author>notishell</author><pubDate>Sat, 31 Aug 2013 00:06:19 +0800</pubDate><description><![CDATA[输入一个整数s，打印出所有和为s的连续正整数序列（至少包含两个数）。例如，对于输入15，由于有1+2+3+4+5=15，4+5+6=15，7+8=15，所以打印出1~5、4~6、7~8三个序列。


有个比较好的做法是利用等差数列求和公式：s=a*n+n*(n-1)/2。这里的a是第一个元素，n是项数。

int solve(int k)
{
	int count = 0;
	for (]]></description><category></category></item><item><title><![CDATA[邻接表表示图]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843887</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843887</guid><author>notishell</author><pubDate>Sat, 10 Aug 2013 20:06:55 +0800</pubDate><description><![CDATA[邻接表表示图是一种标准的做法，简单的做法是使用邻接矩阵，如下面的代码所示。
#include 
#include 
#include 
#include 
#include 
using namespace std;

struct edge {
	int value;
	size_t id;
	struct edge *next;
};

struct vertex {
	string nam]]></description><category></category></item><item><title><![CDATA[图的拓扑排序]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843861</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843861</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:29:28 +0800</pubDate><description><![CDATA[无环有向图可以进行拓扑排序，形象一点说就是，很多件有依赖关系的工作，怎么安排才能一步步进行下去。
拓扑排序的思想很简单，使用邻接表存储图的话，拓扑排序在O(|V|+|E|)的时间内可以完成。下面介绍两种拓扑排序方法。
1、简单的拓扑排序
首先，找出所有入度为0的节点，放入一个队列，然后，取出一个入度为零的节点，删除该节点以及该节点与其它节点的边，将新产生的入度为0的节点加入队列，最后当队列为]]></description><category></category></item><item><title><![CDATA[重建二叉树]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843839</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843839</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:26:26 +0800</pubDate><description><![CDATA[二叉树有前序、中序、后序三种遍历方法，如果知道了其中两种的遍历结果，是不是就可以重建原来的二叉树呢？当然这里是有前提的，二叉树的节点不能有相同的，不然有可能无法还原！
已知前序和中序
前序遍历结果的第一个元素是原二叉树的根，接下来的是左子树和右子树的前序遍历结果。中序遍历结果中根左边的是左子树的中序遍历结果，右边的是右子树的中序遍历结果！我们可以将问题转换为两个子问题，采用递归的方法很容易求解]]></description><category></category></item><item><title><![CDATA[函数调用约定]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843777</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843777</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:24:05 +0800</pubDate><description><![CDATA[在VC中，调用方式有__stdcall，__cdecl，__fastcall，thiscall几种。其中前三种是一般调用所能使用的调用方式，thiscall是类对象调用成员函数时使用的调用方式，当在一个函数前使用__declspec(naked)修饰时，编译器不会在函数的内部将不再产生保存和恢复某些寄存器值的代码。
__stdcall
对于__stdcall调用方式，所有参数通过栈传递，参数压]]></description><category></category></item><item><title><![CDATA[变参函数剖析]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843753</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843753</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:18:23 +0800</pubDate><description><![CDATA[变参函数定义形式如func(type a, …)，要求至少一个固定参数，因为需要通过这个参数来确定究竟有多少个参数、以及参数的类型。
windows中，变参函数用来获取参数的几个宏定义如下。
typedef char *  va_list;
#define _ADDRESSOF(v) (&(v))
#define _INTSIZEOF(n) ((sizeof(n)+sizeof(int)-1)]]></description><category></category></item><item><title><![CDATA[二叉树中节点的最大距离]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843733</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843733</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:15:38 +0800</pubDate><description><![CDATA[二叉树也是一个图，虽然在一般的图中求解简单最长路径问题非常困难，但是在二叉树中却比较简单！我们甚至可以在线性时间内解决问题！
二叉树中距离最长的两个节点一定是叶子节点或根节点，假设有一个节点不是叶子节点或根节点，那么其父亲或者其儿子到另外一个节点的距离比最大距离要大，所以假设错误。如果距离最长的两个节点有一个是根，那么最长距离就等于树的高，而且根只有一个儿子，否则一定存在更长的距离。对于某一个节]]></description><category></category></item><item><title><![CDATA[单链表节点删除问题]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843621</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843621</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:12:07 +0800</pubDate><description><![CDATA[单链表的节点删除一种保守的做法是从头遍历一遍，然后找到要删除节点的前一个节点，修改next指针，最后释放delete节点。实际上有些情况下可以在O(1)的时间内删除节点！
如果节点指针被引用，那么删除单链表的节点就只能遍历一遍来删除了，否则我们完全可以优化删除算法！设要删除的节点为p，当节点需要维持相对顺序时，将节点p->next的值拷贝到节点p，然后删除节点p->next，如果节点p位于末尾，]]></description><category></category></item><item><title><![CDATA[N!的末尾有多少个0？]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843595</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843595</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:10:42 +0800</pubDate><description><![CDATA[N的阶乘末尾有多少0呢？首先，得思考一下0到底是由哪些数贡献的，显而易见，一个2和5能贡献一个0，然后我们只需要计算2和5的因子的个数即可，最后取最小值就是0的个数！
N的阶乘是从1到N的乘积，因子2的个数明显多于5，只需要计算因子5的数量即可。1-N中5的倍数有N/5个，5²的倍数有N/5²个，5³的倍数有N/5³个，……，等等。因此易于求得因子5的个数，见代码6-11行。
计算N的阶乘因子]]></description><category></category></item><item><title><![CDATA[按层遍历二叉树]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843577</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843577</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:09:34 +0800</pubDate><description><![CDATA[按层遍历二叉树是广度优先的算法，这个算法需要一个队列，最开始将根节点入队，然后处理队列，直到队列为空，这样就处理完了整棵树。
好吧，看起来广度优先遍历是这么的简单，与深度优先不同，广度优先使用队列，见下面的代码。处理一个节点时，如果该节点有左儿子将左儿子入队，如果有右儿子将右儿子入队，这样就会按距离遍历完所有的节点。
#include 
#include 
#include 
using na]]></description><category></category></item><item><title><![CDATA[输出单链表的倒数第K个节点]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843557</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843557</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:08:50 +0800</pubDate><description><![CDATA[求解单链表第K个节点或者倒数第K个节点总是一个O(n)的问题！一般的求解倒数第K个问题是转换为求解第N-K个节点的问题，这样需要求出链表总长N，实际上可以做的更好！
求解倒数第K个节点更好的一种做法是不求解链表长度，使用一个指针指向第K个节点，另一个指针指向第一个节点，两个指针同步移动，当第一个指针移动到末尾，第二个指针就指向倒数第K个节点！
#include 
using namespace]]></description><category></category></item><item><title><![CDATA[就地翻转单链表]]></title><link>https://blog.youkuaiyun.com/notishell/article/details/9843539</link><guid>https://blog.youkuaiyun.com/notishell/article/details/9843539</guid><author>notishell</author><pubDate>Thu, 08 Aug 2013 23:07:08 +0800</pubDate><description><![CDATA[翻转单链表是比较简单的事情，就像双向链表插入节点一样，关键在于指针的处理，除此之外没有什么值得关注的！
#include 
using namespace std;

struct list {
	int value;
	struct list *next;
};

struct list *insert(struct list *head, int v)
{
	if (head) {
		he]]></description><category></category></item></channel></rss>