Sort Method Conversion



I need to modify this method to sort an array of strings rather than
chars:

// selectionSort(): sorts the elements of a
public static void selectionSort(char[] v) {
for (int i = 0; i < v.length-1; ++i) {
// guess the location of the ith smallest element
int guess = i;
for (int j = i+1; j < v.length; ++j) {
if (v[j] < v[guess]) { // is guess ok?
// update guess to index of smaller element
guess = j;
}
}

// guess is now correct, so swap elements
char rmbr = v[i];
v[i] = v[guess];
v[guess] = rmbr;
}
}

}

Any ideas?

.



Relevant Pages

  • Re: Sorting Alpha then Numeric
    ... I had to convert the chars, I used Ascand if numeric add 123, I also ... First field enter: ... You will need three blank fields and enter 3 sort order equations ...
    (microsoft.public.access.reports)
  • HELP PLEASE
    ... I am tring to get this preogram to sort an array. ... public static void main{ ... if (itemToInsert> a) ...
    (comp.lang.java.programmer)
  • Re: Textmate vs. TextWrangler
    ... And then you get a table template that you have to edit. ... 'Ctrl+<' saved me 10 chars every time I wanted to create a table I'd ... TextWrangler has a sort of way to do this using text factories, but flexible support for all that sort of stuff is in BBedit. ...
    (uk.comp.sys.mac)
  • Re: Problems with sort (or any alternatives?)
    ... My input file has four fields. ... each 8 chars in the format of ccyymmdd. ... I wish to sort the input file on either the 1st, ... Given your record structure, "-t '.'" will break the line into two ...
    (comp.os.linux.misc)
  • Re: One for Three?
    ... public static void main ... the source code for the map.put method to ... // thought one backslash character is to escape special character like ... you should read an introductory book about Java to learn this sort ...
    (comp.lang.java.programmer)