import java.util.Arrays;

public class SelectionSort {
	
	public int[] selection_sort(int[] arr) {
		int min, temp;
		for (int i = 0; i < arr.length; i++) {
			min = i;
			for (int j = i+1; j < arr.length; j++) {
				if (arr[j] < arr[min]) {
					min = j;
				}
			}

			if (min != i) {
				temp = arr[i];
				arr[i] = arr[min];
				arr[min] = temp;
			}
		}
		
		return arr;
	}

}

@@ -55,191 +55,567 @@
 %0A%09%0A%09
-public int%5B%5D selection_sort(int%5B%5D arr) %7B%0A%09%09int min, temp;%0A%09%09for (int i = 0; i %3C arr.length; i++) %7B%0A%09%09%09min = i;%0A%09%09%09for (int j = i+1; j %3C arr.length; j++) %7B%0A%09%09%09%09if (arr%5Bj%5D %3C arr%5Bmin%5D) %7B
+/**%0A%09 *  Selection Sort is an in-place comparison sort.%0A%09 *  It has O(n%5E2) time complexity.%0A%09 */%0A%09public int%5B%5D selection_sort(int%5B%5D arr) %7B%0A%09%09int min, temp;%0A        /* find the min element in the unsorted array */%0A%09%09for (int i = 0; i %3C arr.length; i++) %7B%0A%09%09    /* assume the min is the first element */%0A%09%09%09min = i;%0A%09%09%09/* test against elements after i to find the smallest */%0A%09%09%09for (int j = i+1; j %3C arr.length; j++) %7B%0A%09%09%09%09/* if this element is less, then it is the new minimum */  %0A%09%09%09%09if (arr%5Bj%5D %3C arr%5Bmin%5D) %7B%0A%09%09%09%09%09/* found new minimum; remember its index */
 %0A%09%09%09
@@ -652,24 +652,49 @@
 min != i) %7B%0A
+%09%09%09%09/* swap i and min */%0A
 %09%09%09%09temp = a

Add docs to Selection Sort