Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 QuickSort implementation help
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
arden




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: 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.
arden




PostPosted: Sat Mar 03, 2007 10:44 am   Post subject: Re: QuickSort implementation help

Sorry, but how do I do that? Smile
wtd




PostPosted: 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? Wink
arden




PostPosted: Sat Mar 03, 2007 11:31 am   Post subject: Re: QuickSort implementation help

Sure, if you want. Shocked

On a serious note, I just changed Comparable[] to Integer[] since we're only testing on integers anyway. Thanks for your help.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: