Computer Science Canada QuickSort implementation help |
Author: | arden [ Sat Mar 03, 2007 10:30 am ] |
Post subject: | QuickSort implementation help |
OK, so here's the deal. Our class has an assignment that has us researching on different sorting algorithms and writing a report on it. First, we have to implement the algorithm to be able to test its functionality. The one I chose is QuickSort. At school, I found a QuickSort class from this site: http://www.java-tips.org/java-se-tips/java.lang/quick-sort-implementation-with-median-of-three-partitioning-and-cutoff-for-small-a.html It compiled fine at school but when I brought it home it stopped working. I hadn't even modified ANYTHING yet. I would get this warning: Quote: [unchecked] unchecked call to compareTo(T) as a member of the raw type java.lang.Comparable
Can someone please help me? That was the simplest implementation of the QuickSort and the only one I could find that was appropriate for my assignment. And the assignment's due pretty soon (Tuesday). Thanks. |
Author: | wtd [ Sat Mar 03, 2007 10:42 am ] |
Post subject: | RE:QuickSort implementation help |
The coe you saw was written for Java 1.4. You are likely using the Java 1.5 compiler, where Comparable is a generic interface. You can either choose to understand this difference, or just tell the compiler that the source is Java 1.4. |
Author: | arden [ Sat Mar 03, 2007 10:44 am ] |
Post subject: | Re: QuickSort implementation help |
Sorry, but how do I do that? ![]() |
Author: | wtd [ Sat Mar 03, 2007 10:58 am ] |
Post subject: | RE:QuickSort implementation help |
Do I get the credit if I do all of your homework for you? ![]() |
Author: | arden [ Sat Mar 03, 2007 11:31 am ] |
Post subject: | Re: QuickSort implementation help |
Sure, if you want. ![]() On a serious note, I just changed Comparable[] to Integer[] since we're only testing on integers anyway. Thanks for your help. |