Groups | Search | Server Info | Keyboard shortcuts | Login | Register
Groups > comp.lang.java.programmer > #4109
| From | Lew <noone@lewscanon.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Did the sort do anything? |
| Date | 2011-05-15 07:07 -0400 |
| Organization | albasani.net |
| Message-ID | <iqoc4o$vq4$1@news.albasani.net> (permalink) |
| References | <a5cc61c3-8ac4-46e1-823c-9d3251f9f67a@glegroupsg2000goo.googlegroups.com> |
Don't post using the stupid GoogleGroups email-like method that breaks conversations due to lack of respect for headers, and is signaled by a "reply-to" with an email-like "...@googlegroups.com" address. It's also blazingly useless to cc an "invalid" email address, and rude to write Usenet business to an individual email account anyway. Please use a proper newsreader if you cannot get GoogleGroups to respect the conversations. It's ridiculously annoying and also pretty useless to have your post isolated from the context to which it applies. It On 05/15/2011 12:49 AM, Gene wrote: > On Tuesday, May 10, 2011 11:06:38 AM UTC-4, Roedy Green wrote: >> Often you sort things when they are already sorted. >> >> I am interested in simple algorithms to detect whether the sort >> actually did anything. >> >> Some suggestions: >> >> 1. do a pairwise compare of the times before the sort, and if all is >> in order, bypass the sort. > > If you suspect that the list is close to sorted, you can do one bubble sort pass moving out-of-place elements to their correct locations. At the same time you can track whether this pass produces a completely sorted list and call the library sort if that's not the case. Comments to your point should be reserved for the connected conversation and not out in this lonely island of nowhere. -- Lew Honi soit qui mal y pense. http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Re: Did the sort do anything? Gene <gene.ressler@gmail.com> - 2011-05-14 21:49 -0700
Re: Did the sort do anything? Lew <noone@lewscanon.com> - 2011-05-15 07:07 -0400
Re: Did the sort do anything? Robert Klemme <shortcutter@googlemail.com> - 2011-05-15 14:07 +0200
csiph-web