2016年7月8日

Find Median from Data Stream

摘要: Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two 阅读全文

posted @ 2016-07-08 16:31 Sheryl Wang 阅读(224) 评论(0) 推荐(0) 编辑

hashheap python 实现

摘要: 这个hashheap的实现可以既可以是最大堆,也可以是最小堆,同时因为hash表中存的value是在heap数组中的index和这个key值的数目,所以可以处理重复数字.关键在于siftup和siftdown的非递归实现.siftdown相当于heapify,但是之前只使用过递归版本. 阅读全文

posted @ 2016-07-08 11:53 Sheryl Wang 阅读(946) 评论(0) 推荐(0) 编辑

导航