04 2016 档案
c++ 覆盖、重载与隐藏
摘要:成员函数被重载的特征:(1)相同的范围(在同一个类中);(2)函数名字相同;(3)参数不同; //具体分为参数个数不同、参数类型不同、const(4)virtual 关键字可有可无。覆盖是指派生类函数覆盖基类函数,特征是:(1)不同的范围(分别位于派生类与基类);(2)函数名字相同;(3)参数相同; 阅读全文
posted @ 2016-04-26 20:44 Seven_noon 阅读(305) 评论(0) 推荐(1)
Merge k Sorted Lists
摘要:是分治思想。设k为链表个数,每个链表含有n个元素。则有T(k)=2T(k/2)+nk;由递归树可以求出时间复杂度为O(nklogk)。代码如下: 阅读全文
posted @ 2016-04-13 16:46 Seven_noon 阅读(139) 评论(0) 推荐(0)
Valid Parentheses 使用递归的解法
摘要:class Solution { public: bool isValid(string s) { if(s.size()hashmap; hashmap['(']=')'; hashmap['[']=']'; hashmap['{']='}'; if(s.size()==2)return hashmap[s... 阅读全文
posted @ 2016-04-13 09:44 Seven_noon 阅读(302) 评论(0) 推荐(0)
Regular Expression Matching leetcode
摘要:递归方法运行时间过长。考虑使用动态规划的方法。 代码如下: 阅读全文
posted @ 2016-04-07 18:01 Seven_noon 阅读(138) 评论(0) 推荐(0)


点击右上角即可分享
微信分享提示