Ctrl/Cmd + P and select "Save as PDF".
Input: sequence of n numbersOutput: permutation such that a'1 <= a'2 <= ... <= a'n 1. Start with second element. 2. Compare with previous elements. 3. Shift elements greater than key to the right. 4. Insert key in correct position.
public static int linearSearch(int[] arr, int target) {
for (int i = 0; i < arr.length; i++) {
if (arr[i] == target) return i;
}
return -1;
}min = A[0]
for i = 1 to n:
if A[i] < min:
min = A[i]
return min