码迷,mamicode.com
首页 >  
搜索关键字:递归 return    ( 77935个结果
C++ Daily 《4》----一个简单的 int to string 的方法
经常会在项目中用到 int to string #include #include #include using namespace std; int main(void) { ostringstream num; num << 123; string str = num.str(); cout << str << endl; return 0; }...
分类:编程语言   时间:2014-07-22 23:04:54    阅读次数:283
【LeetCode】- Length of Last Word(最后一个单词的长度)
[ 问题: ] Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. [...
分类:其他好文   时间:2014-07-22 23:01:35    阅读次数:331
【LeetCode】- Search Insert Position(查找插入的位置)
[ 问题: ] Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in th...
分类:其他好文   时间:2014-07-22 23:01:15    阅读次数:270
Lua进阶(一)——函数闭包、元表
函数闭包 function createCountdownTimer(second) local ms=second * 1000; local function countDown() ms = ms - 1; return ms; end return countDown; end timer1 = createCountdownTimer(1); for...
分类:其他好文   时间:2014-07-22 22:59:53    阅读次数:307
Subsets II
leetcode, Subsets II...
分类:其他好文   时间:2014-05-02 20:17:59    阅读次数:271
strassen算法——矩阵乘法
strassen算法可以看做是分治递归法求解矩阵乘法的改进。 利用分治递归法求解矩阵乘法的过程大致: 矩阵C = A * B(A、B、C都是n x n矩阵) 可以发现(A11 * B11)、(A12 * B21)……等子矩阵的乘法运算需要继续递归。上面有8个乘法,所以需要递归8次。 时间复杂度关系公式 T(n) = 8T(n/2) + O(n^2),这里8T(n/2)是8次递归...
分类:其他好文   时间:2014-05-01 08:43:52    阅读次数:549
新手学python(3):yield与序列化
1 Yield生成器        Yield是我在其他语言中没有见过的一个属性,算是python的一大特色,用好之后可以使代码更简洁。考虑一个简单的例子,文件的遍历。要遍历一个目录下的所有文件需要递归的操作。如果我们只是单纯的打印文件名,我们可以在递归的过程中完成,每当发现一个非目录就可以打印文件名。代码如下: class TraverseDirectory(object): @s...
分类:编程语言   时间:2014-04-30 22:48:40    阅读次数:312
js:深入函数(函数是对象)
//由于函数是对象,所以可以直接把函数通过参数传递进来;也可以把函数作为返回值。 function calFun(fun,arg){   //第一个参数就是函数对象   return fun(arg); } function sum(num){   return num+100; } function say(str){   alert("hello "+str); } //...
分类:Web程序   时间:2014-04-30 22:41:38    阅读次数:324
【梦幻连连连】源码分析(一)
进入游戏连连第一个场景,如下:   初始化该场景精灵所需的信息、背景/音效及图层UI bool HelloWorld::init() {     //////////////////////////////     // 1. super initfirst     if (!CCLayer::init() )     {         return false;...
分类:其他好文   时间:2014-04-30 22:34:40    阅读次数:226
查询、创建、设置注册表键值的示例代码
示例代码将在注册表位置:HKEY_CURRENT_USER\Software\  读写键值 bool LicenseManage::OpenRegKey(HKEY& hRetKey) { if (ERROR_SUCCESS == RegOpenKey(HKEY_CURRENT_USER,"Software", &hRetKey)) { return true; ...
分类:其他好文   时间:2014-04-30 22:12:40    阅读次数:195
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!