![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
文章平均质量分 75
CarrieSmile
这个作者很懒,什么都没留下…
展开
-
线段树
线段树:记录区间统计信息。原理是将将[1,n]分解成若干特定的子区间(数量不超过4*n),然后,将每个区间[L,R]都分解为少量特定的子区间,通过对这些少量子区间的修改或者统计,来实现快速对[L,R]的修改或者统计。可以记录的统计值必须符合区间加法。符合区间加法的例子:数字之和,最大公因数,最大/小值。不符合区间加法的例子:众数——只知道左右区间的众数,没法求总区间的众数01序列的最长连续零——只...原创 2018-02-18 08:50:44 · 199 阅读 · 0 评论 -
heap
堆, 优先队列,可以用来排序,计算top k问题heap property: In a max-heap, the max-heap property is that for every node i other than the root, A[parent([i)] >= A[i]. That is, the value of the node is at most the value ...原创 2018-05-24 09:21:28 · 418 阅读 · 0 评论 -
编程语言-java中的一些用法
java中的PriorityQueue允许自定义comparator来定义PriorityQueue中的元素是按怎样的规则排序 插入到heap中的。用法: PriorityQueue<ListNode> queue= new PriorityQueue<ListNode>(lists.size(),new Comparator<ListNode>(){ ...原创 2018-05-24 09:21:46 · 227 阅读 · 0 评论