Saturday, 15 June 2013

java - Sort Array by Alpabetical order using SelectionSort -


I am referring to my code on the math website on selection coding, according to which the int string is added to my case, and also as alphabetical order. My current code for SelectionSort below LastName :

  public static zero selection selection (student [] cents ) {Int i, j, first; String floating; String jLastName = ""; String firstlatname = ""; String iLastName = ""; For (i = st.length - 1; i>; i--) {first = 0; For (j = 1; j; l; = i; j ++) {if (st [j] .getLastName ()! = Null) {jLastName = st [j] .getLastName (); If (cnt [first] .getLlastName ()! = Null) {firstLastName = st [first] .getLastName (); If ((jLastName.compareToIgnoreCase (First Name Name)) <0) {first = j; }}}} ILastName = st [i] .getLastName (); Temp = firstListName; FirstListName = iLastName; ILastName = temp; }}  

Sorry for the naming of the variable I do not give the error to me, however, the output does not show that it has been sorted according to the alphabetical order. Do I know which part I have made a mistake? Thanks

This algorithm is sorted in descending order

  Temp = st [first]; St. [First] = St. [I]; St [ii] = temporary;  

No comments:

Post a Comment