2015年1月8日

Binary Search Tree Iterator

摘要: QUESTIONImplement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will retur... 阅读全文

posted @ 2015-01-08 23:38 joannae 阅读(131) 评论(0) 推荐(0) 编辑

2015年1月3日

Factorial Trailing Zeroes (Divide-and-Conquer)

摘要: QUESTIONGiven an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.FIRST TRYclass Sol... 阅读全文

posted @ 2015-01-03 19:21 joannae 阅读(216) 评论(0) 推荐(0) 编辑

Excel Sheet Column Number(STRING-TYPE CONVERTION)

摘要: QUESTIONRelated to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For examp... 阅读全文

posted @ 2015-01-03 17:06 joannae 阅读(156) 评论(0) 推荐(0) 编辑

Majority Element(ARRAY-BINARY SEARCH)

摘要: QUESTIONGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume t... 阅读全文

posted @ 2015-01-03 10:47 joannae 阅读(148) 评论(0) 推荐(0) 编辑

Excel Sheet Column Title (STRING - TYPE CONVERTION)

摘要: QUESTIONGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... ... 阅读全文

posted @ 2015-01-03 07:34 joannae 阅读(202) 评论(0) 推荐(0) 编辑

2014年12月24日

C++强制转换

摘要: static_cast,dynamic_cast, const_cast, reinterpret_castdynamic_cast比static_cast多了安全检测,判断源和目标有无继承被继承关系,所以强制将父类指针赋给子类指针的时候只能用static_cast。如class D:public ... 阅读全文

posted @ 2014-12-24 06:18 joannae 阅读(133) 评论(0) 推荐(0) 编辑

C++ volatile

摘要: volatile的位置与const相同——都是作为类型的附加修饰符使用volatile的主要目的是提示编译器该对象的值可能在编辑器未监测的情况下被改变,因此编译器不能武断地对引用这些对象的代码作优化处理。 阅读全文

posted @ 2014-12-24 06:16 joannae 阅读(157) 评论(0) 推荐(0) 编辑

C++ auto

摘要: auto用来声明自动变量。它是存储类型标识符,表明变量(自动)具有本地范围。块范围的变量声明(如for循环体内的变量声明)默认为auto存储类型。好处:auto变量在离开作用域是会变程序自动释放,不会发生内存溢出情况(除了包含指针的类),比较安全。例:for (auto it = dict.begi... 阅读全文

posted @ 2014-12-24 06:15 joannae 阅读(314) 评论(0) 推荐(0) 编辑

C++的编译与连接

摘要: 编译器的任务是把我们人类通常能够读懂的文本形式的 C 语言文件转化成计算机能明白的目标文件。1. 预编译生成的仍然是.c文件1)把"include"的文件拷贝到要编译的源文件中。 2)用实际值替代"define"的文本。3)在调用宏的地方进行宏替换。2. 编译这个过程是用于生成汇编语言,.asm文件... 阅读全文

posted @ 2014-12-24 06:14 joannae 阅读(519) 评论(0) 推荐(0) 编辑

C++ template

摘要: 在模板定义语法中关键字class与typename的作用完全一样。什么是类模板如果一个类中数据成员的数据类型不能确定,或者是某个成员函数的参数或返回值的类型不能确定,就必须将此类声明为模板类模板定义Step1: 声明模板三种声明形式:1。基本模板类template2。带默认类型形参template3... 阅读全文

posted @ 2014-12-24 06:13 joannae 阅读(240) 评论(0) 推荐(0) 编辑

导航