Results 1 to 4 of 4
  1. #1
    syle_q is offline Member
    Join Date
    Mar 2011
    Posts
    12
    Rep Power
    0

    Default 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

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,266
    Rep Power
    25

    Default 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.

  3. #3
    syle_q is offline Member
    Join Date
    Mar 2011
    Posts
    12
    Rep Power
    0

    Default Re: Implementing quick sort on a array of strings.

    I am looking at the java API and rooking at
    Java Code:
    public interface Comparable <T>
    , which take in objects "T". So I'm assuming that "T" can just be string objects. Is this the method you speak of?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Quick sort problem
    By fishy8158 in forum New To Java
    Replies: 0
    Last Post: 02-18-2012, 04:21 AM
  2. Replies: 2
    Last Post: 12-04-2011, 08:21 AM
  3. Implementing quick sort and binary search
    By syle_q in forum New To Java
    Replies: 1
    Last Post: 04-07-2011, 08:46 PM
  4. Using Merge Sort to sort an ArrayList of Strings
    By coldfire in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 01:03 AM
  5. Quick Sort explanation.
    By hawaiifiver in forum New To Java
    Replies: 4
    Last Post: 03-10-2009, 02:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •