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 always sorted, such as 
a tree or a priority queue (backed by a heap or something). That way you 
only sort the new item that's being added. It's also likely that you can 
create a sorting system that is very efficient for adding a single item 
to an already sorted list. Basically, what you need to do is exploit the 
fact that your list is sorted, and you're adding something to it.

-- 
Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]>

Hostes alienigeni me abduxerunt. Qui annus est?

PGP Key 0xA99CEB6D = 5957 6D23 8B16 EFAB FEF8  7175 14D3 6485 A99C EB6D

Attachment: pgpD7zXov7HhW.pgp
Description: PGP signature

Reply via email to