Question about Sorting Algorithms in Java

Discussion in 'OT Technology' started by SPACECATAZ, Oct 6, 2009.

  1. SPACECATAZ

    SPACECATAZ New Member

    Joined:
    Dec 22, 2006
    Messages:
    2,502
    Likes Received:
    0
    Say I want to have an array of information about dvd titles. The information would be title, genre, running time, release date, and price.

    Then an example of that array would be something like(all elements are strings):

    Say if have an array such as ({"Dracula 300 + Horror + 120 + 1986 + 60.00", "Best of Bratwurst 2000 + Adventure + 130 + 2003 + 20.00"})

    I'm not sure I set that up right, but I was reading some sorting algorithms on wikipedia and I believe that I have to use merge sort one but I'm not sure. What I want to do is sort the array according to the dvd title in ascending order. I know I have to sort the array by characters, but I'm not quite sure how to scan the array and compare the first letter of a title against the first letter of next dvd in index 1. When comparing them, this would then put Best of Bratwurst into index 0 and Dracula 3000 into index 1.

    How would I go about doing something like that in Java? :confused:
     

Share This Page