p
BAN USERStudent
Hey guys...
good discussion... I'd like to jump in...
if we have an N-way heap the complexity would remain logarithmic. The only thing is before it was Log-base-2 and now it would be log-base-(max n).... n is a constant and hence in terms of complexity we could any time change it to base-2 and ignore the constant generated.... so we're all fine
Well yeah ..there can also be another version instead of incrementing a count and then search could be inefficient..so what we could do is when a cache hit occurs we delete the entry from there and shift it at the end.... and also new records are inserted at end....so when we have to delete any thing we delete the first element in the link list... this is actually more near to Least Recently Used... but LRU and LFU are almost the same....
- p February 19, 2012
the above algo has a couple of bugs according to me... now say suppose we have an empty min heap the u said to return maxheap.peek() that is the max element and not the median and vice-versa ... if u dont have the min heap... am I right?
- p February 20, 2012