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: 5,686
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?
>



try

http://www.mathworks.com/matlabcentral/fileexchange/23576-minmax-selection

"Description

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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.