help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Recursive find of set of maximum numbers


From: thombark
Subject: Recursive find of set of maximum numbers
Date: Thu, 20 Oct 2011 01:11:52 -0700 (PDT)

I have a vector of integers sorted in descending order. I need to extract the
indexes of the maximum sum of N values, then the next maximum sum etc.

For example, there are 10 integers a(1) to a(10), where a(1) is the largest
number and a(10) is the smallest. Let's say N=3. The first max sum would
give me the obvious vector of (1,2,3) then the next max sum would give me
(1,2,4).  But the next max sum vector could be (1,2,5) or (2,3,4) depending
on the values in a(). If a is (10000,10,9,8,7...) then (1,2,5) is the
resulting vector but if a is (100,90,80,70,10...) then (2,3,4) is the
result. The very last vector to be returned would be (8,9,10).   

Is there a built-in function that would cut down the processing time of this
algorithm? 

Thanks.



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Recursive-find-of-set-of-maximum-numbers-tp3921183p3921183.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]