JuliaLang/DataStructures.jl — pull request #68 by cpitclaudel (2014-12-30 15:53:19+00:00)
Title: Implement nlargest and nsmallest

Python's heapq module offers two convenient functions, [`nlargest` and `nsmallest`](https://docs.python.org/2/library/heapq.html#heapq.nlargest). This patch replicates part of that functionality (the `key` argument is missing − it should probably be a feature of the underlying heap).

For performance reasons I added an `extract_all_rev!` method, but since `extract_all` wasn't documented in `README.md` I didn't document it either. I also added relevant tests in `test_binheap.jl`.