![]() |
|
|
|
#1 |
|
Posts: n/a
|
Would someone post the code for the insertion sort on an array of some
type? |
|
|
|
#2 |
|
Posts: n/a
|
you lazy
"Tim923" <> wrote in message news:... > Would someone post the code for the insertion sort on an array of some > type? |
|
|
|
#3 |
|
Posts: n/a
|
>you lazy
I already earned my BA degree. This is just for personal interest. |
|
|
|
#4 |
|
Posts: n/a
|
Tim923 wrote: >>you lazy > > > I already earned my BA degree. This is just for personal interest. Something rings false about the second sentence. If you have a personal interest in insertion sorts, why ask someone else to provide the code? If insertion sorts are so interesting to you, why ask someone else to have all the fun? Tell you what, though: I'll offer some code for an Even Better sorting method, one that will outperform an insertion sort on virtually every measure in almost every circumstance. Here ya go: java.util.Arrays.sort(array_of_Comparable); Hope this helps. -- |
|
|
|
#5 |
|
Posts: n/a
|
In <> Tim923 wrote:
>>you lazy > > I already earned my BA degree. This is just for personal interest. > Looks like it's time to enroll again and get that Master's degree, your Bachelor's has obviously not taught you to think for yourself... |
|
|
|
#6 |
|
Posts: n/a
|
Caine wrote:
> In <> Tim923 wrote: >>> you lazy >> >> I already earned my BA degree. This is just for personal interest. >> > > Looks like it's time to enroll again and get that Master's degree, > your Bachelor's has obviously not taught you to think for yourself... Which, frankly concerns me... that without knowing how to think for one's self, one could be accepted into and presumably complete the Master's program. -- Virgil |
|
|
|
#7 |
|
Posts: n/a
|
> Something rings false about the second sentence. If
>you have a personal interest in insertion sorts, why ask >someone else to provide the code? Busting my butt for years to get my 4 year math degree at Binghamton University entitles me to ask such questions about courses that don't count for degrees. It's a well known policy. http://www.jptc.org/cont_2.html |
|
|
|
#8 |
|
Posts: n/a
|
Tim923 wrote: >> Something rings false about the second sentence. If >>you have a personal interest in insertion sorts, why ask >>someone else to provide the code? > > > Busting my butt for years to get my 4 year math degree at Binghamton > University entitles me to ask such questions about courses that don't > count for degrees. It's a well known policy. It's possible that you're being atrociously misjudged, but you must admit that the request looks peculiar in the extreme. A few of the red flags: - You specify an insertion sort, and are presumably unwilling to use an implementation of any other sorting algorithm. Thus your goal is not to sort something (I offered code for that), but to do an insertion sort. I can think of only one context that calls for one not-very-good sorting algorithm, and that's homework. - Well, no: Other contexts exist. Insertion sort has poor asymptotic behavior but small constant factors, so it can outperform "superior" algorithms on very short files. Practical sorting implementations often switch to insertion sort (or something like it) once they've "almost sorted" the large file. You may be implementing such a thing -- but if you were capable of doing so, you would also be capable of writing the six or eight lines of an insertion sort without needing to ask for help. - You say you want an insertion sort "just for personal interest" -- and that still rings false to me. People who are interested in a topic generally want to do their own investigation/participation/discovery, not ask other people to have the fun as proxies. Nothing you've written thus far explains (or even attempts to explain) this attitudinal oddity. Perhaps if you would explain how you intend to use the code (and why you're not up to the simple task of writing it yourself), nasty suspicious people like me might become more sympathetic. -- |
|
|
|
#9 |
|
Posts: n/a
|
"Virgil Green" <> wrote in message news:LkT6e.746$. .. > Caine wrote: > > In <> Tim923 wrote: > >>> you lazy > >> > >> I already earned my BA degree. This is just for personal interest. > >> > > > > Looks like it's time to enroll again and get that Master's degree, > > your Bachelor's has obviously not taught you to think for yourself... > > Which, frankly concerns me... that without knowing how to think for one's > self, one could be accepted into and presumably complete the Master's > program. > > -- > Virgil > I still say lazy. Why? Because google produces a zillion examples with java code. |
|
|
|
#10 |
|
Posts: n/a
|
> Tell you what, though: I'll offer some code for an
> Even Better sorting method, one that will outperform an > insertion sort on virtually every measure in almost every > circumstance. Here ya go: > > java.util.Arrays.sort(array_of _Comparable); OK, I'm up for the challenge. Let's measure performance in terms of memory. Insertion definitely beats the system sort (mergesort) here. Insertion sort is a great algorithm if the files are small, and this explains why the system sort cuts off to insertion sort on small files. Also insertion sort runs in linear time if the input is sorted or nearly sorted, and these inputs tend to arise in practice. |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java code to send MS Outlook Tasks | mansi | Software | 0 | 03-03-2009 08:20 AM |
| Java with Asp.net | mdinant | Software | 0 | 04-04-2008 11:21 AM |
| Java Error: java.lang.ClassFormatError: oracle/jdbc/ttc7/TTC7Protocol | Shalz | Software | 0 | 03-08-2008 05:05 PM |
| Java Beginners | Still Bill | Software | 3 | 02-19-2008 09:13 AM |
| How To Access HTML elements in code behind??? | nedums_b | Software | 1 | 02-07-2008 06:15 PM |