🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1563

Re: Advice needed for fastest sort algorthm

#1563
From: Warwick Allison
Date: Tue, 17 Nov 1992 04:29
19 lines
1031 bytes
I've got it!  The FASTEST sorting algorithm, I call it "TwoSort":


void TwoSort(int* data)
{
	if (*data > data[1]) *data^=data[1]^=*data^=data[1];
}


This works for all integer data, where the number of elements to be sorted is 2.


--
Warwick
--
  _-_|\      warwick@cs.uq.oz.au            /Disclaimer:
 /     * <-- Computer Science Department,  /  
 \_.-._/     University of Queensland,    /   C references are NULL && void*
      v      Brisbane, Australia.        /  
Technical Details
Message-ID: <11077@uqcspe.cs.uq.oz.au>
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!munnari.oz.au!bunyip.cc.uq.oz.au!uqcspe!cs.uq.oz.au!warwick
References: <BxG0MC.7yK@chinet.chi.il.us> <10991@uqcspe.cs.uq.oz.au> <1992Nov11.043526.26732@netcom.com> <1992Nov11.161052.5552@panther.mot.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!munnari.oz.au!bunyip.cc.uq.oz.au!uqcspe!cs.uq.oz.au!warwick
From: warwick@cs.uq.oz.au (Warwick Allison)
Newsgroups: rec.games.programmer
Subject: Re: Advice needed for fastest sort algorthm
Message-ID: <11077@uqcspe.cs.uq.oz.au>
Date: 17 Nov 92 04:29:51 GMT
References: <BxG0MC.7yK@chinet.chi.il.us> <10991@uqcspe.cs.uq.oz.au> <1992Nov11.043526.26732@netcom.com> <1992Nov11.161052.5552@panther.mot.com>
Sender: news@cs.uq.oz.au
Reply-To: warwick@cs.uq.oz.au
Lines: 19