摘要: 快排 排序 阅读全文
posted @ 2014-11-07 10:53 Tristan Sun 阅读(176) 评论(0) 推荐(0) 编辑
摘要: /** Copyright 2009, Google Inc.* All rights reserved.** Redistribution and use in source and binary forms, with or without* modification, are permitted provided that the following conditions are* met:** * Redistributions of source code must retain the above copyright* notice, this list of conditions 阅读全文
posted @ 2013-06-15 15:39 Tristan Sun 阅读(1346) 评论(0) 推荐(0) 编辑
摘要: Mac OS Mountain Lion默认是没有安装X11的,而wireshark运行需要x11,因此如果直接安装wireshark而没有安装x11,wireshark不会正常运行。去苹果主页下载最新版本的xQuartz,然后运行wireshark,会弹出一个选择x11的界面,选择/Application/Utilities目录下的xQuartz程序,点击确定,然后X11会运行,弹出一个xterm窗口,在其中运行/Application/Wireshark.app/Contents/MacOS/Wireshark,就会执行一系列初始化,然后打开wireshark界面。以后再运行wiresha 阅读全文
posted @ 2013-02-26 11:59 Tristan Sun 阅读(6581) 评论(0) 推荐(0) 编辑
摘要: 去https://github.com/SiteSupport/gevent/downloads下载合适的版本如果是.tar.gz,那么解压,运行 python setup.py install,即可成功安装 阅读全文
posted @ 2013-02-25 16:19 Tristan Sun 阅读(55) 评论(0) 推荐(0) 编辑
摘要: c++中const可用于修饰方法1. 第一种情况:const位于方法参数列表后,如 void test() const; 此种情况表明,此方法不会改变调用对象的状态,保证了调用对象的常量性2. 第二种情况:const 位于返回类型前 此情况表明返回对象为常量,不可改变,例如以下代码: A& test(A& a) { return a; } 如果不用const修饰,则我们可以写出这样的合法语句: test(a) = b; 为了避免这种情况,我们声明为 const A& test(A& a); 在编译期杜绝 阅读全文
posted @ 2012-07-14 15:48 Tristan Sun 阅读(1062) 评论(0) 推荐(0) 编辑
摘要: 如果二叉树树叶总数为n0,度为2的节点总数为n2,那么有n0=n2+1,下面论证这一关系假设树叶总数为0,度为1的节点总数为n1,度为二的节点总数为n2,那么二叉树总结点数n满足以下关系:n = n0 + n1 + n2另一方面,除根节点以外的所有节点总数,即 n - 1 = n1 + 2n2综合两式,我们有 n1 + 2n2 + 1 = n0 + n1 + n2于是很明显 n0 = n2 + 1 阅读全文
posted @ 2012-03-31 17:17 Tristan Sun 阅读(4691) 评论(0) 推荐(0) 编辑
摘要: http://www.jb51.net/article/15707.htm### 阅读全文
posted @ 2012-03-28 14:58 Tristan Sun 阅读(166) 评论(0) 推荐(0) 编辑