Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Finding top-k elements without using sort function
Replies: 2   Last Post: Jun 24, 2013 2:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 6,064
Registered: 2/7/05
Re: Finding top-k elements without using sort function
Posted: Jun 24, 2013 1:51 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 6/24/2013 12:23 AM, Ang Zhi Ping wrote:
> From an array of n floating points, I would like to extract the top k
> elements. Among the k they do not need to be sorted. Short of using the
> sort function in MATLAB, is there any faster method for extract the top k?




Using a partial quick-sort algorithm implemented with C-MEX.
The complexity is O(n + k.log(k)), where n is the size of the
array, and k is the number of elements to be selected.

Faster than SORT or multiple call of MIN/MAX for large size inputs"

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum 1994-2015. All Rights Reserved.