SHARE
TWEET

17325 Nikola




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- public class App2 {
- public static void SelectSort(int[] arr){
- for (int i = 0; i < arr.length - 1; i++)
- {
- int index = i;
- for (int j = i + 1; j < arr.length; j++) {
- if (arr[j] < arr[index]) {
- index = j;
- }
- }
- int currMIN = arr[index];
- arr[index] = arr[i];
- }
- }
- public static void main(String a[]){
- int[] arr1 = {7,14,66,8,53};
- System.out.println("Before sorting: ");
- for(int i:arr1){
- System.out.print(i+ " ");
- }
- System.out.println();
- SelectSort(arr1);
- System.out.println("After sorting: ");
- for(int i:arr1) {
- System.out.print(i + " ");
- }
- }
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.