摘要: 今天没事用C写了下快排。C++泛型算法库里有sort(),因此已经很少自己写了。 1 #include <stdbool.h> 2 3 /* QuickSort Algorithim */ 4 void QuickSort(int *begin, int *end) 5 { 6 if(begin == end)return; 7 int *left = begin, *right = end-1; 8 int tmp; //for swap; 9 10 bool L2R = false; //search direction11 12 ... 阅读全文
posted @ 2012-12-10 19:43 hilbertan 阅读(180) 评论(0) 推荐(0) 编辑
摘要: 写了一个类,主要目的是实现csv文件的读取和处理以及操作。包括计算收益率,按月合并,等等。csv文件需满足:第一列为日期,且格式为yyyy-mm-dd。 1 //FileReader.h 2 3 #ifndef FILEREADER_H 4 #define FiLEREADER_H 5 #include<string> 6 #include<vector> 7 8 9 10 class FileReader11 {12 public:13 14 enum Term { day, month };15 16 FileReader(const std::str... 阅读全文
posted @ 2012-12-10 05:18 hilbertan 阅读(273) 评论(0) 推荐(0) 编辑