[Gllug] [OT] sort algorithms

James Courtier-Dutton james.dutton at gmail.com
Tue Nov 29 22:29:16 UTC 2011

On 29 November 2011 22:02, David L Neil <GLLUG at getaroundtoit.co.uk> wrote:
> James,
>> Target pattern is a list of numbers in a certain predefined sequence.
>> The source data is a set of numbers that is always a subset of the
>> predefined sequence.
>> I need a way to sort the source data so that the numbers appear in the
>> same order as the predefined sequence.
> What is the order of magnitude of the numbers in the source data set/in the
> predefined sequence?
Magnitude is the input/predefined sequence is between 0 and 2^32.  I.e
0 to MAXINT32

> How large/small a proportion of the predefined sequence is/are the source
> data set(s) likely to be?
The source sequence will always be shorter than the predefined
sequence. Source is a subset of the predefined sequence.
> Is each record in the source unique with respect to the number in the set or
> may there be several with the same 'number',
> eg result may be 1 1 8 8 4 4 3 3 9 9
There should not be any duplicates in the source or predefined sequence.

> Tools?
> eg is the data in a [No]SQL DB/working totally in RAM, C/Python...
> (if it matters to you)

I am looking for an efficient algorithm. Language does not really
matter. Could be C or a LISP type language.
Gllug mailing list  -  Gllug at gllug.org.uk

More information about the GLLUG mailing list