home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!news.claremont.edu!ucivax!news.service.uci.edu!beckman.com!dn66!a_rubin
- Newsgroups: comp.lang.c
- Subject: Re: bogosort revisited (with source)
- Message-ID: <a_rubin.715969133@dn66>
- From: a_rubin@dsg4.dse.beckman.com (Arthur Rubin)
- Date: 8 Sep 92 16:18:53 GMT
- References: <Bu41Lu.IKB@news.cso.uiuc.edu> <1992Sep6.023647.1872@smds.com>
- <1992Sep6.111107.16924@grebyn.com> <1992Sep6.164314.14858@athena.mit.edu>
- Nntp-Posting-Host: dn66.dse.beckman.com
- Lines: 34
-
- In <1992Sep6.164314.14858@athena.mit.edu> tada@athena.mit.edu (Michael J Zehr) writes:
-
- >Okay, deterministic and horrible:
-
- >Generate all sorted lists of length N of numbers drawn from the domain
- >of the elements you're sorting.* (for example, all sorted lists of 2^32
- >bit patterns.) (there are a lot of them, bounded by 2^32^N for this
- >example.)** Check to see if the list contains exactly the elements you're
- >trying to sort. (Do this by some O(N^2) algorithm.)
-
- >This is now O(n^2 * K^N) where K is the number of unique elements of the
- >data type that the sort will handle. Furthermore, it's deterministic.
-
- >-michael j zehr
-
- >_______
- >* If you want, generate all sets instead of just the sorted one. Then
- >you get horrible space as well as time characteristics!
-
- >** I couldn't quickly come up with the closed form of this expression,
- >but I only had about ten minutes to spare. Can someone else do better?
- >It looks really messy after N>3...
-
- / 2^32 \ (2^32) !
- | | = ----------------
- \ N / (2^32-N)! N!
-
-
- (Well, you asked.)
- --
- Arthur L. Rubin: a_rubin@dsg4.dse.beckman.com (work) Beckman Instruments/Brea
- 216-5888@mcimail.com 70707.453@compuserve.com arthur@pnet01.cts.com (personal)
- My opinions are my own, and do not represent those of my employer.
- My interaction with our news system is unstable; please mail anything important.
-