Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9770

Re: Did the sort do anything?

From Cindy <c.thurston@frell.okb.uwa.edu>
Newsgroups comp.lang.java.programmer
Subject Re: Did the sort do anything?
Date 2011-11-07 22:22 -0500
Organization UWA OKB
Message-ID <j9a79e$8jb$1@speranza.aioe.org> (permalink)
References <4d8fb7l8qb1g820cphr4fh447a9uitlddj@4ax.com> <itslo8-iq7.ln1@dagon.net> <j9a63g$6e6$1@speranza.aioe.org>

Show all headers | View raw


On 07/11/2011 10:02 PM, Cindy wrote:
> 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.

Clarification: "equivalent" in the sense that knowing the answer to 
either immediately tells you the answer to the other. However, the 
answers, of course, have opposite signs here so you'd have to negate one 
to get the other.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

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