Median after K additional integers | Find median of array after adding k elements ; sorting the array in increasing order . ; printing the median of array . Since n + K is always odd and K < n , so median of array always lies in the range of n . ; driver function
def printMedian ( arr , n , K ) : NEW_LINE INDENT arr . sort ( ) NEW_LINE print ( arr [ int ( ( n + K ) / 2 ) ] ) NEW_LINE DEDENT arr = [ 5 , 3 , 2 , 8 ] NEW_LINE k = 3 NEW_LINE n = len ( arr ) NEW_LINE printMedian ( arr , n , k ) NEW_LINE