Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: markspace <-@.> Newsgroups: comp.lang.java.programmer Subject: Re: Using Java Classes to Sort a Small Array Quickly Date: Wed, 31 Aug 2011 20:39:09 -0700 Organization: A noiseless patient Spider Lines: 22 Message-ID: References: <86c4a53b-1ca1-48a8-b954-c01bd449278a@s35g2000prm.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 1 Sep 2011 03:39:24 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="13494"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18i3YjhvXieiH5wKtEdzIg0VpUCGUJi1Wk=" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20110812 Thunderbird/6.0 In-Reply-To: <86c4a53b-1ca1-48a8-b954-c01bd449278a@s35g2000prm.googlegroups.com> Cancel-Lock: sha1:dwX3RSRnLlnRMsndUqt0ZGKjT2A= Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:7507 On 8/31/2011 7:48 PM, KevinSimonson wrote: > On the way home from work my fellow carpooler told me that there are > Java classes that can do sorts in O(N) time. Pfft. No. Theoretical maximum speed of a sort is something like n log n. The only data you can sort in n time is data that's already sorted. > my InsertionSort code > still beat it. How many projects can you have? For small arrays anything is fast and even a bubble sort should work fine. If you have many projects... how do you code that up as an enum anyway? Sorry but there's a little red flashing light labeled "warning!" that's going off in my mind right now.