RE: How to manage around 1000 entries which will constantly be changing

2006-04-05 Thread Wagner, David --- Senior Programmer Analyst --- WGO
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. If at any time you

Re: How to manage around 1000 entries which will constantly be changing

2006-04-04 Thread Wagner, David --- Senior Programmer Analyst --- WGO
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 discard

Re: How to manage around 1000 entries which will constantly be changing

2006-04-03 Thread Jay Savage
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 discard

Re: How to manage around 1000 entries which will constantly be changing

2006-04-01 Thread Frank Bax
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

Re: How to manage around 1000 entries which will constantly be changing

2006-04-01 Thread Robin Sheat
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

RE: How to manage around 1000 entries which will constantly be changing

2006-04-01 Thread Charles K. Clarkson
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

Re: How to manage around 1000 entries which will constantly be changing

2006-04-01 Thread Mr. Shawn H. Corey
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

How to manage around 1000 entries which will constantly be changing

2006-03-31 Thread Wagner, David --- Senior Programmer Analyst --- WGO
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

Re: How to manage around 1000 entries which will constantly be changing

2006-03-31 Thread Mr. Shawn H. Corey
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 or

Re: How to manage around 1000 entries which will constantly be changing

2006-03-31 Thread Tom Phoenix
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 at

Re: How to manage around 1000 entries which will constantly be changing

2006-03-31 Thread Mr. Shawn H. Corey
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

Re: How to manage around 1000 entries which will constantly be changing

2006-03-31 Thread Wiggins d'Anconia
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;# OBperl:

Re: How to manage around 1000 entries which will constantly be changing

2006-03-31 Thread Mr. Shawn H. Corey
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. But