You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class Jb18_ArrSort
|
|
|
|
|
{
|
|
|
|
|
public static void main(String[] args)
|
|
|
|
|
{
|
|
|
|
|
int[] arr = {71,15,4,50,54,55,5,45,454,496,78,};
|
|
|
|
|
ergodic(arr);
|
|
|
|
|
//selectSort(arr); //<2F><><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
//bubbleSort(arr); //<2F><><EFBFBD><EFBFBD>ð<EFBFBD><C3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
Arrays.sort(arr); //<2F><><EFBFBD><EFBFBD>Java<76><61><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
ergodic(arr);
|
|
|
|
|
}
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public static void ergodic(int[] arr)
|
|
|
|
|
{
|
|
|
|
|
for (int x=0; x<arr.length; x++)
|
|
|
|
|
{
|
|
|
|
|
if (x!=arr.length-1)
|
|
|
|
|
System.out.print(arr[x]+",");
|
|
|
|
|
else
|
|
|
|
|
System.out.println(arr[x]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/*ѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public static void selectSort(int[] arr)
|
|
|
|
|
{
|
|
|
|
|
for (int x=0;x<arr.length-1 ;x++ )
|
|
|
|
|
{
|
|
|
|
|
for (int y=x+1;y<arr.length ; y++)
|
|
|
|
|
{
|
|
|
|
|
if (arr[x]>arr[y])
|
|
|
|
|
{
|
|
|
|
|
int temp = arr[x];
|
|
|
|
|
arr[x] = arr[y];
|
|
|
|
|
arr[y] = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
//ð<><C3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
public static void bubbleSort(int[] arr)
|
|
|
|
|
{
|
|
|
|
|
for (int x=0; x<arr.length-1; x++)
|
|
|
|
|
{
|
|
|
|
|
for (int y=0;y<arr.length-x-1 ;y++ ) //-x<><78><EFBFBD><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
if (arr[y]>arr[y+1])
|
|
|
|
|
{
|
|
|
|
|
int temp = arr[y];
|
|
|
|
|
arr[y] = arr[y+1];
|
|
|
|
|
arr[y+1] = temp;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|