I need to handle a set of numbers where I want only the lowest 1000.
There will be no rhyme or reason as the data comes in. I will do some
calculations and take this total against the array or hash or ? The
number of calculations will be tremendous and either I come up with a way t
On Fri, 2006-31-03 at 15:12 -0800, Wagner, David --- Senior Programmer
Analyst --- WGO wrote:
> I need to handle a set of numbers where I want only the lowest 1000.
> There will be no rhyme or reason as the data comes in. I will do some
> calculations and take this total against the array
On 3/31/06, Wagner, David --- Senior Programmer Analyst --- WGO
<[EMAIL PROTECTED]> wrote:
> I need to handle a set of numbers where I want only the
> lowest 1000. There will be no rhyme or reason as the data comes in.
You should loop over the input, pushing each item on to an array. If
a
On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote:
> You should loop over the input, pushing each item on to an array. If
> at any time you have 2000 items in the array, sort them and discard
> any you don't want to keep.
>
> $#data = 999 if $#data > 999;# OBperl: one way to discard
Mr. Shawn H. Corey wrote:
> On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote:
>
>>You should loop over the input, pushing each item on to an array. If
>>at any time you have 2000 items in the array, sort them and discard
>>any you don't want to keep.
>>
>>$#data = 999 if $#data > 999;
On Fri, 2006-31-03 at 17:15 -0700, Wiggins d'Anconia wrote:
> Unless the sort optimizes out the need to loop through so many elements,
> and/or is written at a lower level. If each new item that is entered
> goes in the last place then you have to loop over every element of the
> list every time. B
At 06:59 PM 3/31/06, Mr. Shawn H. Corey wrote:
On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote:
> You should loop over the input, pushing each item on to an array. If
> at any time you have 2000 items in the array, sort them and discard
> any you don't want to keep.
>
> $#data = 999 if
On Sunday 02 April 2006 02:57, Frank Bax wrote:
> At the moment, the array is left unsorted. If I use a sorted array, it
> needs to resorted every time a "worst" entry is replaced by a "new"
> entry. Can I avoid sorting the array every iteration?
Have you considered using a data structure that is
Robin Sheat wrote:
: Have you considered using a data structure that is always sorted,
: such as a tree or a priority queue (backed by a heap or
: something).
From the Heap::Simple docs:
A heap is a partially sorted structure where it's always easy
to extract the smallest element. If the
On Sat, 2006-01-04 at 09:57 -0500, Frank Bax wrote:
> I'm not the OP, but I have a script with a similar problem. The script has
> some logic that generates many (thousands of billions) of combinations from
> a little bit of data and only the best 100 combos are output. For each
> combination p
On 4/1/06, Frank Bax <[EMAIL PROTECTED]> wrote:
> At 06:59 PM 3/31/06, Mr. Shawn H. Corey wrote:
>
> >On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote:
> > > You should loop over the input, pushing each item on to an array. If
> > > at any time you have 2000 items in the array, sort them and di
On 4/1/06, Frank Bax <[EMAIL PROTECTED]> wrote:
> > At 06:59 PM 3/31/06, Mr. Shawn H. Corey wrote:
> >
> > >On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote:
> > > > You should loop over the input, pushing each item on to an array. If
> > > > at any time you have 2000 items in the array, sort t
Wagner, David --- Senior Programmer Analyst --- WGO wrote:
> On 4/1/06, Frank Bax <[EMAIL PROTECTED]> wrote:
>>> At 06:59 PM 3/31/06, Mr. Shawn H. Corey wrote:
>>>
On Fri, 2006-31-03 at 15:45 -0800, Tom Phoenix wrote:
> You should loop over the input, pushing each item on to an array.
>>>
13 matches
Mail list logo