![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
write_algorithm
文章平均质量分 80
姜菌
这个作者很懒,什么都没留下…
展开
-
Windows 下的计时类 StopWatch
常用到的一个类,是修改别人的代码来的,出处忘了。使用imp形式是为了把 windows.h 从头文件中拿掉,对于需要支持多平台的代码有用。代码中为什么不用 std::unique_ptrStopwatchImp> ? 因为 unique_ptr 需要在解析头文件时知道 StopwatchImp 的定义。前置申明可以,但是得在此头文件结束之前给出类的定义,Stopwatch 做不到。原创 2012-12-05 17:41:06 · 744 阅读 · 0 评论 -
rod_cutting, introduction to algorithm 3rd, example 15.1
算法导论 第三版, 15.1动态规划问题的实现// introduction to algorithm 3rd, example 15.1#include #include #include #include #include "stopwatch.h"static int price_table[] ={ 1, 5, 8, 9, 10, 17,原创 2012-12-05 18:12:30 · 908 阅读 · 0 评论 -
matrix_chain_multiplication, introduction to algorithm 3rd, example 15.2
算法导论 第三版 15.2动态规划问题的实现// introduction to algorithm 3rd, example 15.2#include #include #include #include #include #include #include #include "stopwatch.h"struct Matrix{原创 2012-12-05 18:15:23 · 788 阅读 · 0 评论 -
optimal_binary_search_tree introduction to algorithm 3rd, example 15.5
算法导论 第三版 15.5动态规划问题// optimal_binary_search_tree introduction to algorithm 3rd, example 15.5#include #include #include #include #include #include #include #include #include原创 2012-12-07 14:59:38 · 808 阅读 · 0 评论 -
longest common subsequence introduction to algorithm 3rd, example 15.4
算法导论 第三版 15.4动态规划问题升级到vs2012 update1, 结果仍然没有C++11的初始化列表功能, 测试函数里面给vector添加data就比较丑了。//longest common subsequence introduction to algorithm 3rd, example 15.3#include #include #include原创 2012-12-06 17:41:16 · 828 阅读 · 0 评论 -
KMP (Knuth-Morris-Pratt) algorithm introduction to algorithm 3rd, example 32.4
算法导论 第三版 32.4 KMP//KMP (Knuth-Morris-Pratt) algorithm introduction to algorithm 3rd, example 32.4#include #include #include #include #include #include #include #include #in原创 2012-12-10 19:46:54 · 849 阅读 · 0 评论 -
greatest common divisor introduction to algorithm 3rd, example 31.2
算法导论 第三版 31.2// greatest common divisor introduction to algorithm 3rd, example 31.2#include #include int gcd(int a, int b){ if (b == 0) { return a; } return原创 2012-12-12 18:46:58 · 755 阅读 · 0 评论