04 2017 档案

摘要:24. Swap Nodes in Pairs Total Accepted: 156137 Total Submissions: 413794 Difficulty: Medium 3m 37.45% 25. Reverse Nodes in k-Group Total Accepted: 890 阅读全文
posted @ 2017-04-25 20:41 PKICA 阅读(208) 评论(0) 推荐(0) 编辑
摘要:61. Rotate List(M) Total Accepted: 102574 Total Submissions: 423333 Difficulty: Medium 16ms 19.35% 19. Remove Nth Node From End of List Total Accepted 阅读全文
posted @ 2017-04-24 21:26 PKICA 阅读(219) 评论(0) 推荐(0) 编辑
摘要:素数筛选法比较有名的,较常用的是Sieve of Eratosthenes,为古希腊数学家埃拉托色尼(Eratosthenes 274B.C.~194B.C.)提出的一种筛选法。详细步骤及图示讲解,还有java与c++版源代码. 素数在信息安全中有着重要应用. 阅读全文
posted @ 2017-04-24 16:52 PKICA 阅读(303) 评论(0) 推荐(0) 编辑
摘要:优先队列:priority_queue<Type, Container, Functional>Type 为数据类型, Container 为保存数据的容器,Functional 为元素比较方式。Container 必须是用数组实现的容器,比如 vector, deque 但不能用 list.STL 阅读全文
posted @ 2017-04-23 16:56 PKICA 阅读(1506) 评论(0) 推荐(0) 编辑
摘要:sort属于C++范畴,在algorithm头文件中,下面直奔主题,给大家一个清晰明了的认识.qsort有C,和C++两个版本. qsort的compare函数原型 //comp ,也就说,如果the first < the second 返回-1,;如果the first > the second 阅读全文
posted @ 2017-04-23 11:12 PKICA 阅读(679) 评论(0) 推荐(0) 编辑
摘要:2017-04-22 什么是贪心算法呢?所谓贪心算法是指,在对问题求解时,总是做出在当前看来最好的选择。也就是说,不从整体最优解出发来考虑,它所做出的仅是在某种意义上的局部最优解。 贪心策略适用的前提是:局部最优策略能导致产生全局最优解。 实际上,贪心算法适用的情况很少。选择的贪心策略必须具备无后效 阅读全文
posted @ 2017-04-22 15:38 PKICA 阅读(236) 评论(0) 推荐(0) 编辑
摘要:First non-repeating character in a stream Given an input stream of n characters consisting only of small case alphabets the task is to find the first 阅读全文
posted @ 2017-04-20 17:07 PKICA 阅读(439) 评论(0) 推荐(0) 编辑
摘要:transform的功能类似于for_each,但是transform,传参数一次拷贝,返回时一次拷贝,不能保证按序执行,而for_each传参使用引用,不需要拷贝,可以保证有序执行。 std::transform Defined in header <algorithm> template< cl 阅读全文
posted @ 2017-04-16 10:52 PKICA 阅读(856) 评论(0) 推荐(0) 编辑
摘要:C++11:C++11包括大量的新特性:包括lambda表达式,类型推导关键字auto、decltype,和模板的大量改进。 新的关键字 auto C++11中引入auto第一种作用是为了自动类型推导 auto的自动类型推导,用于从初始化表达式中推断出变量的数据类型。通过auto的自动类型推导,可以 阅读全文
posted @ 2017-04-14 11:09 PKICA 阅读(65443) 评论(9) 推荐(6) 编辑
摘要:值得学习的leetcoder: uwi Location Japan Neal Zane Neal@阳谷县 School:SJTU 你瞧,leetcode都让我们稍事休息了。2017-04-11 19:29 这都不重要,我想说的是:leetcode是一个目前我所见的online judge中最好的一 阅读全文
posted @ 2017-04-11 19:29 PKICA 阅读(524) 评论(0) 推荐(0) 编辑
摘要:Output: [5] [7] [7] [5] 5 [5] [7] [7] [5] 5 阅读全文
posted @ 2017-04-06 12:31 PKICA 阅读(287) 评论(0) 推荐(0) 编辑
摘要:C++ constexpr类型说明符 const 和 constexpr 变量之间的主要区别在于:const 变量的初始化可以延迟到运行时,而 constexpr 变量必须在编译时进行初始化。所有 constexpr 变量均为常量,因此必须使用常量表达式初始化。 constexpr 函数是在使用需要 阅读全文
posted @ 2017-04-05 21:55 PKICA 阅读(4545) 评论(0) 推荐(2) 编辑