Procedure Select(A,n,v) if n <= 4 then return A[0] m = n/5 for i=0 to m-1 j = 5*i B[i] = Middle(A[j],A[j+1],A[j+2],A[j+3],A[j+4]) endfor Pivot = Select(B,m,v) Position = Partition(A,0,n-1,Pivot) return Select(A,Position,v) end Procedure Partition(A,Left,Right,Pivot) L = Left R = Right while L < R do while A[L] < = Pivot and L < = Right do L=L+1; while A[R] > Pivot and R > = Right do R=R-1; if L < R then swap A[L] and A[R] return R end
NOTE: First describe WHAT you will need to show. A significant component of the credit will be for this portion. Then fill out the details.