What is the most efficient way to make the n smallest numbers from a sequence,
[ [1 2 3] [9 2 1] [2 3 4] [5 6 7] ]
I would like to take the 2 smallest of the sequence based on the first element,
[1 2 3] [2 3 4]
I am currently sorting the entire list and then taking the first n elements, but this is probably not the most efficient way, it is a large list, and I need to do this often.
algorithm clojure
Hamza yerlikaya
source share