in reply to Re: Creating a sub-list constrained by an average while maintaining maximum number of original elements
in thread Creating a sub-list constrained by an average while maintaining maximum number of original elements

But that solves only half of the problem, which was also to keep as much as possible of the original list. By eliminating a big one, you may have overshot your target too much, causing you to eliminate a lot of small ones to make up for it.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

  • Comment on Re^2: Creating a sub-list constrained by an average while maintaining maximum number of original elements

Replies are listed 'Best First'.
Re^3: Creating a sub-list constrained by an average while maintaining maximum number of original elements
by BrowserUk (Patriarch) on Sep 01, 2010 at 12:28 UTC

    That is a theoretical possibility, but I challenge you to produce a 100,000 file dataset + target average for which it happens?

    (Note: I only ever discard big ones or little ones; never both!)


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.