Wednesday, May 4, 2011
compareTo Method
I have previously used the compareTo method in the Selection sort program for an array of Simple Objects. I could have made my life easier had I noticed that I created the method before for the Array of Objects assignment. The compareTo method returns a negative value if a should come before b; 0 if a and b are the same and a positive value otherwise. This method can also be accessed from the super class. I have understood Quick sort and created a basic skeleton program for sorting an array of integers with Quick sort.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment