simultaneous multiple key sorting algorithm

Manfred Nowak svv1999 at hotmail.com
Fri Jan 27 23:08:51 PST 2012


Andrei Alexandrescu wrote:

> generally what one wants is a selection of "best of breed" stocks
> that are among the top ones in a variety of categories. (Relative
> importance could be assigned to each category.) 

This is quite different and easier than the problem initially
stated, because ranks must not be computed.

1) Compute the individual importance `ii' of each element `e', which 
seems to be the sum over all categories `c' of all
  `e.c.value * c.importance'  
2) Use the linear median algorithm to find the element `ek' whose 
individual importance `ek.ii' has rank `k' in the set of all elements 
`e' and `k' is the number of elements `e' acceptable as "best of the 
breed"
3) return all elements `e' whith `e.ii >= ek.ii'. This can be done
by a sweep over the array. 

Total running time aproximately: #elements * #categories


Please note, that this relies on having choosen the vector of relativ 
importances for the categories correctly. How does one know about this 
correctness?

For example in marketing it is desired to occupy unique selling 
points, because the gain of profit might be huge. But this means, that 
also the less for the buyer is huge. 

-manfred 




More information about the Digitalmars-d mailing list