Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #9766
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail |
|---|---|
| From | Cindy <c.thurston@frell.okb.uwa.edu> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Did the sort do anything? |
| Date | Mon, 07 Nov 2011 22:02:05 -0500 |
| Organization | UWA OKB |
| Lines | 13 |
| Message-ID | <j9a63g$6e6$1@speranza.aioe.org> (permalink) |
| References | <4d8fb7l8qb1g820cphr4fh447a9uitlddj@4ax.com> <itslo8-iq7.ln1@dagon.net> |
| NNTP-Posting-Host | PeK9C/JchrWuRhsTrIEaEA.user.speranza.aioe.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Complaints-To | abuse@aioe.org |
| User-Agent | tin/1.6.2-20030910 ("Pabbay") (UNIX) (CYGWIN_NT-6.0/1.5.22(0.156/4/2) (i686)) Hamster/2.0.2.2 |
| X-Notice | Filtered by postfilter v. 0.8.2 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9766 |
Show key headers only | View raw
On 07/11/2011 3:50 PM, Dagon wrote: > Note that #1 is a different question than you asked. "would a sort > change the order" is not the same as "did a sort change the order". Isn't the simplest method (assuming a stable sort algorithm is/would be used) just to grovel over the input checking that thing[n] < thing[n+1] and returning true immediately if not, and false if the end of the input is reached? I.e., "is it already sorted?" seems equivalent to "would a sort change the order?" when the sort would be a stable sort. For "did the sort change the order?" just copy the input, sort, and then check the unsorted copy in like fashion; or check the input, store the result, and sort (or check the input, store the result, and sort iff the result says the input's not sorted).
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Did the sort do anything? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-07 01:27 -0800
Re: Did the sort do anything? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-07 02:20 -0800
Re: Did the sort do anything? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-07 11:21 +0000
Re: Did the sort do anything? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-11-07 10:49 +0000
Re: Did the sort do anything? Roedy Green <see_website@mindprod.com.invalid> - 2011-11-07 02:58 -0800
Re: Did the sort do anything? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-07 07:11 -0500
Re: Did the sort do anything? Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-11-07 08:30 -0600
Re: Did the sort do anything? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-07 21:03 -0500
Re: Did the sort do anything? markspace <-@.> - 2011-11-07 07:48 -0800
Re: Did the sort do anything? dagon@dagon.net (Dagon) - 2011-11-07 12:50 -0800
Re: Did the sort do anything? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-07 22:02 -0500
Re: Did the sort do anything? Cindy <c.thurston@frell.okb.uwa.edu> - 2011-11-07 22:22 -0500
Re: Did the sort do anything? Arne Vajhøj <arne@vajhoej.dk> - 2011-11-07 17:42 -0500
csiph-web