算法导论
原理、实现细节、复杂度证明
算法真的复杂
有了基本思路后,如何以最简洁的方式去实现关键点,非常重要。简洁意味着清楚、易理解、不易出错
快速排序-移动单边指针
/*CimplementationQuickSort*/#include<stdio.h>//Autilityfunctiontoswaptwoelementsvoidswap(int*a,int*b){intt=*a;*a=*b;*b=t;}/*Thisfunctiontakeslas
如何实现算法
可以实现的描述单元
c++ constructor, copy constructor, operator =
//list::push_back#include<iostream>#include<list>classelement{private:intnumber;public:element(intnumber){this->number=number;std::cout
阶段性总结
1、MySQL中List实现与C++库的List实现不同2、类的关系不清楚,需要类图来理清3、流程不是非常清晰,需要列出接口4、探索性实现,先实现简要框架,对要完善的功能加上todo,以便记忆
库的标准实现和私有实现的选择
假设在稳定的情况下,对比功能。极大可能,私有实现没有全部的功能。
c++ combination by next_permutation
#include<iostream>#include<algorithm>#include<vector>intmain(){intn,r;n=10;r=2;std::vector<bool>v(n);std::fill(v.end()-r,v.end
算法需要加强
先使用,再看源码,再模仿
索引组合算法原型
//next_permutationexample#include<iostream>//std::cout#include<algorithm>//std::next_permutation,std::sortintmake_combination(intmyints[],
innodb_index_stats
mysql>select*frommysql.innodb_index_statsWHEREdatabase_name='test'andtable_name='recordsInRangeTest';+---------------+--------------------+--------
感悟
感悟精通数据结构精通算法精通工程工具切合业务场景
scidb
貌似是给科学家用的数据库,暂不研究
想到一个异常低的代价去实现一个极好的功能
这阵子忙完去实现。哈哈哈
c++返回引用
#include<iostream>#include<ctime>usingnamespacestd;doublevals[]={10.1,12.6,33.1,24.1,50.0};double[]&setValues(inti){returnvals;//retur
c++ class as sort function
//constructingsets#include<iostream>#include<set>#include<string.h>boolfncomp(intlhs,intrhs){returnlhs<rhs;}structclasscomp{boolo
指针级联容易错误
a->b->c假如b是空指针,则容易造成运行错误
c++ list_iterator demo
#include<iostream>#include<list>usingnamespacestd;typedeflist<int>IntegerList;intmain(){IntegerListintList;for(inti=1;i<=10;++i)i
模板元编程例子
#include<iostream>#include<string>usingnamespacestd;template<intN>classPow3{public:staticconstintresult=3*Pow3<N-1>::result;};
utf8字符串分区间
待理解