摘要: A string s is LUCKY if and only if the number of different characters in s is a fibonacci number. Given a string consisting of only lower case letters 阅读全文
posted @ 2016-08-31 15:16 0giant 阅读(1430) 评论(0) 推荐(0) 编辑
摘要: 定义 拥有权值观点的queue,,一个是返回最高优先级对象,一个是在底端添加新的对象。这种数据结构就是优先级队列(Priority Queue) 。 实现 利用max_heap完成,以vector表现的完全二叉堆。max_heap可以满足priority_heap所需要的依照权值高低自动递减的特性。 阅读全文
posted @ 2016-08-31 11:21 0giant 阅读(669) 评论(0) 推荐(0) 编辑
摘要: 在STL中考虑到小型区块所可能造成的内存碎片问题,SGI STL设计了双层级配置器,第一级配置器直接使用malloc()和free();第二级配置器则视情况采用不同的策略:当配置区块超过128bytes 时,则视之为足够大,便调用第一级配置器;当配置区块小于128bytes时,则视之为过小,为了降低 阅读全文
posted @ 2016-08-31 09:30 0giant 阅读(2213) 评论(0) 推荐(0) 编辑