Blitz (19/218)

From:Steve Hargreaves
Date:3 Aug 2001 at 21:47:19
Subject:sort and sortlist

Hello all,

I'm trying to sort a dynamically changing array:-

I use a list array initially. I can either:-

1)
Pass the list array to a statement, where a standard array of the same size is
declared, the list array copied into it, and the standard array sorted. Then
copy the elements back to the list array.

This works if I do it in the main code, but as soon as I try it on a local array
in a statement, the Sort command crashes, and I have to reboot. Any idea why.

(I want a local array so that if the size of the array shrinks, I don't have to
clear out all the garbage I'll get in the first elements after a sort - it would
be freed when the statement exits). Alternatively, is there any way to free a
standard array so that it can be re-dimmed once it's been declared?

2)
Sort the list array. I've been playing with the Sortlist command, but it doesn't
work on strings, and all elements of my array are strings. Is there any way to
do this.

3) Write my own sort routine - something I'm loathe to do. Besides, I've only
ever done a bubble sort, and I'm sure it could be done quicker.

The List array may contain up to 5000 items.

All the best

Steve.
========================================================
//Amiga 1200, '060/50, OS3.9, EZ-Tower, Dopus,
// PC Keyboard W EZ-Key, 56K modem, 2+16 Meg,
\\ // NEC 2A Multisync, Logic 3 SpeedMouse, HPDJ610C,
\\/ Sega Controller, & no hair.

=========================================================
I hear sounds. The sounds of billions of people calling your name. -
My followers? - Your victims.
-- Elric and Londo

---------------------------------------------------------------------
To unsubscribe, e-mail: blitz-list-unsubscribe@netsoc.ucd.ie
For additional commands, e-mail: blitz-list-help@netsoc.ucd.ie