Re: [Nolug] php: list sorting algorithm help

From: Clinton R. Nixon <crnixon_at_anvilwerks.com>
Date: Tue, 23 Dec 2003 22:26:26 -0600
Message-Id: <200312232226.26501.crnixon@anvilwerks.com>

On Tue December 23 2003 23:03, Christopher M. Jones wrote:
> I need an algorithm to sort a list in the following way (in php):
> ...
> The first field is a unique ID, the second is an association with some
> other entry in the list. This allows topics and subtopics (represented
> above with dashes) of infinite levels to be contained in the same list
> (there are reasons I need this).
>
> I have been struggling with this. I think I am at the limit of my
> programming prowess. Can anybody help, or give me the crucial pointer
> in the right direction?

That is no way to store data - there's no real identifiers for sub-lists. Also
- is this a hash (associative array) in PHP? I'm trying to figure out what's
your key here and what's your value. If the first number is the key, a simple
sort of the keys gives you your second list.

E-mail me on-list or off-list with some more info about what your data
structure is, and I'll run you through what to do.

- Clinton R. Nixon
___________________
Nolug mailing list
nolug@nolug.org
Received on 12/23/03

This archive was generated by hypermail 2.2.0 : 12/19/08 EST