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


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

Re: Help with java insertion sort program

From Mike Amling <mamling@chaff.us>
Newsgroups comp.lang.java.programmer
Subject Re: Help with java insertion sort program
Date 2014-08-13 23:51 -0500
Message-ID <c52tikF32e8U1@mid.individual.net> (permalink)
References <ls6k6e$v0r$1@dont-email.me> <c4p280F12qiU1@mid.individual.net> <ls7lu3$6ip$1@dont-email.me>

Show all headers | View raw


On 8/10/14 6:43 AM, Eric Sosman wrote:
> On 8/10/2014 7:09 AM, Mike Amling wrote:
>> On 8/9/14 9:11 PM, Scott Dunning wrote:
>>> Hello I trying write a sorting program that will ask a user what type of
>>> sorting method to use (insertion, bubble, selection) and then ask them
>>> to enter integers to sort.
>>
>> One wonders why classes are still teaching these algorithms. I've had
>> colleagues who have written bubble sort into production code, because
>> that's the only algorithm they were ever taught (or maybe it was better
>> than some even worse ones).
>>
>> If you do complete this assignment, throw away the code, look up
>> QuickSort, implement a reasonable variation of it, and don't look back.
>
>      Better still, look up Arrays.sort() and Collections.sort() and
> throw away your Quicksort implementation.

How do you get Arrays.sort to sort primitives descending?

What if you want to, say, apply the same permutation to the elements of 
array Y that sorting applies to the elements array X?

--Mike Amling
VG8gc29ydCBpbnRbXSB4IGRlc2NlbmRpbmcsIHJlcGxhY2UgZXZlcnkgZWxlbWVudCB4W2pdIHdp
dGggLTEteFtqXSBhbmQgY2FsbCBBcnJheXMuc29ydCh4KSwgdGhlbiBhZ2FpbiByZXBsYWNlIGV2
ZXJ5IHhbal0gd2l0aCAtMS14W2pdLg==

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


Thread

Help with java insertion sort program Scott Dunning <scottwd01@gmail.com> - 2014-08-09 19:11 -0700
  Re: Help with java insertion sort program Jeff Higgins <jeff@invalid.invalid> - 2014-08-09 22:28 -0400
    Re: Help with java insertion sort program Jeff Higgins <jeff@invalid.invalid> - 2014-08-09 23:34 -0400
      Re: Help with java insertion sort program Scott Dunning <scottwd01@gmail.com> - 2014-08-09 21:11 -0700
        Re: Help with java insertion sort program Jeff Higgins <jeff@invalid.invalid> - 2014-08-10 00:30 -0400
          Re: Help with java insertion sort program Jeff Higgins <jeff@invalid.invalid> - 2014-08-10 00:45 -0400
            Re: Help with java insertion sort program Jeff Higgins <jeff@invalid.invalid> - 2014-08-10 05:58 -0400
          Re: Help with java insertion sort program Jeff Higgins <jeff@invalid.invalid> - 2014-08-10 05:54 -0400
  Re: Help with java insertion sort program Mike Amling <mamling@chaff.us> - 2014-08-10 06:09 -0500
    Re: Help with java insertion sort program Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-10 07:43 -0400
      Re: Help with java insertion sort program Mike Amling <mamling@chaff.us> - 2014-08-13 23:51 -0500
        Re: Help with java insertion sort program Eric Sosman <esosman@comcast-dot-net.invalid> - 2014-08-14 08:07 -0400
      Re: Help with java insertion sort program Mike Amling <mamling@chaff.us> - 2014-08-14 00:46 -0500
    Re: Help with java insertion sort program Arne Vajhøj <arne@vajhoej.dk> - 2014-08-19 16:50 -0400
  Re: Help with java insertion sort program Roedy Green <see_website@mindprod.com.invalid> - 2014-08-12 03:00 -0700
    Re: Help with java insertion sort program Mike Amling <mamling@chaff.us> - 2014-08-13 23:51 -0500
      Re: Help with java insertion sort program Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2014-08-14 14:30 +0300

csiph-web