SPUG: Sort an array question

Brian Hatch spug at ifokr.org
Thu Dec 26 18:09:25 CST 2002



> Cool, Thanks!  I'll look into this.  I've never used
> IPC module before.  Seems like a good place to check.

IPC == InterProcess Communication.

I cheeted - I piped the array to the 'sort' unix
command, and read the results back in.

> One of the
> stipulations as I started working on it at the board
> was that everything be sorted in a single array. 
> "Without creating a new memory space" is what the guy
> said if I remember correctly.  

Well, using fork/exec to launch the unix sort command
would certainly violate that requirement.  But it is
fun.

A quick sort or bubble sort would fit his requirement,
no doubt.  An insertion sort could if you take from one
array and grow a second array if you consider that
there's a net zero change in memory usage, but that's
probably not what he wanted.


--
Brian Hatch                  "Draal told Zathras what
   Systems and                to do. So Zathras will do.
   Security Engineer          Or much, much dying."
http://www.ifokr.org/bri/

Every message PGP signed
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 240 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20021226/23c529fc/attachment.bin


More information about the spug-list mailing list