![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
文章平均质量分 77
skip_yj
这个作者很懒,什么都没留下…
展开
-
c++ 哈希表的实现
最近想自己写个lru缓存练练手,于是乎就从最基本的hashmap开始着手,原本打算用容器机制来实现的,后来想想直接用模板能省不少力,不过每个溢出链表的空间多了不少。 #include #include #include #define HASHSIZE 4096 using namespace std; template class HashMap { priv原创 2013-06-20 17:50:32 · 547 阅读 · 0 评论 -
最长递增子序列
一道面试题,最长递增子序列,使用二分查找+动态规划,时间复杂度为nlog(n)。写的时候发现二分查找的变种需要注意的细节还是挺多的。 #include #include #define MIN -999999 int binary_search(int val[], int size, int key) { int start, end, mid;原创 2013-06-21 15:04:44 · 402 阅读 · 0 评论