Results 1 to 4 of 4
- 03-27-2012, 02:45 AM #1
Member
- Join Date
- Mar 2011
- Posts
- 12
- Rep Power
- 0
Implementing quick sort on a array of strings.
I need to sort an array of "textbook" objects using quick sort and then find a given book using binary search. But I am having trouble grasping how to sort strings in alphabetical order. I am aware of the comparable interface in java and its functionality but is their a way that I can use the interface to compare strings?
Thanks for the advice!
Kyle
- 03-27-2012, 02:54 AM #2
Re: Implementing quick sort on a array of strings.
The String class has a method for comparing Strings.
If you don't understand my response, don't ignore it, ask a question.
- 03-27-2012, 03:52 AM #3
Member
- Join Date
- Mar 2011
- Posts
- 12
- Rep Power
- 0
Re: Implementing quick sort on a array of strings.
I am looking at the java API and rooking at
, which take in objects "T". So I'm assuming that "T" can just be string objects. Is this the method you speak of?Java Code:public interface Comparable <T>
-
Re: Implementing quick sort on a array of strings.
You need to look at the methods in the String API
Similar Threads
-
Quick sort problem
By fishy8158 in forum New To JavaReplies: 0Last Post: 02-18-2012, 04:21 AM -
How can I sort an array of strings that contain numbers, letters and dashes?
By DylanDubya in forum New To JavaReplies: 2Last Post: 12-04-2011, 08:21 AM -
Implementing quick sort and binary search
By syle_q in forum New To JavaReplies: 1Last Post: 04-07-2011, 08:46 PM -
Using Merge Sort to sort an ArrayList of Strings
By coldfire in forum New To JavaReplies: 3Last Post: 03-13-2009, 01:03 AM -
Quick Sort explanation.
By hawaiifiver in forum New To JavaReplies: 4Last Post: 03-10-2009, 02:28 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks