in reply to Re: Limit the size of a hash (beware of 'add one and (re)sort and discard' algorithms)
in thread Limit the size of a hash
Yes, but if you first compare the new item with the smallest of the 10 already stored, you will very rarely add it to the set of 10 and re-sort. This would be a "conditionally discard, add, and re-sort" algorithm.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Limit the size of a hash (beware of 'add one and (re)sort and discard' algorithms)
by BrowserUk (Patriarch) on Sep 05, 2013 at 15:20 UTC |