The pseudocode for selection sort is:
Given: array of elements, size of the array Returns: nothing, sorts values in array for i = 0 to i < size - 1 set min to array[i+1] (scan rest of the array for its minimum) set minPos to i+1 for j = i+2 to j < size if array[j] < min set min to array[j] set minPos to j end-if end-for if min < array[i] (swap if rest of array has a smaller value than array[i]) set array[minPos] to array[i] set array[i] to min end-if end-forThe pseudocode for insertion sort is:
Given: array of elements, size of the array Returns: nothing, sorts values in array for pos = 1 to pos < size set value to array[pos] set j to pos (scan sorted subset for correct position, also shift to make hole for array[pos]) while value < array[j-1] set array[j] to array[j-1] (shift the larger element up one slot) decrement j if j equals 0 (stop when we reach the start of the array) break out of loop end-if end-while set array[j] to value (copy into hole made by above loop) end-forEmail your completed lab8.cpp to me.