/* * To change this template, choose Tools | Templates * and open the template in the editor.

*/ /** * * @author Natasha Ngo */ public class SortA { public int int for static int[] Intsort(int[]A){ n = A.length; a,b; (int i=0;i<n;i++){ for(int j=1;j<=(n-1);j++){ if (A[j]<A[j-1]){ a=A[j]; b=A[j-1]; A[j-1]=a; A[j]=b;} }

} return(A); } public static String[] stringsort(String[]A){ int n = A.length; String x,y; for (int i=0;i<=n;i++){ for(int j=1;j<=n-1;j++){ if(A[j-1].compareTo(A[j])>0){ x=A[j]; y=A[j-1]; A[j-1]=x; A[j]=y;} } } return(A); } }

Sign up to vote on this title
UsefulNot useful