human
Sort first k values in ascending order and remaining n | Function to sort the array.
Store the k elements in an array.
Store the remaining n - k elements in an array.
sorting the array from 0 to k - 1 places.
sorting the array from k to n places.
storing the values in the final array arr.
printing the array.
Driver code"
Solution in Python:
 Give me a code to sort first k values in ascending order and remaining n and the other steps required?
assistant
#Here is code to sort first k values in ascending order and remaining n and the other steps required.
 def printOrder ( arr , n , k ) :
	len1 = k
	len2 = n - k
	arr1 = [ 0 ] * k
	arr2 = [ 0 ] * ( n - k )
	for i in range ( k ) :
		arr1 [ i ] = arr [ i ]
	for i in range ( k , n ) :
		arr2 [ i - k ] = arr [ i ]
	arr1 . sort ( )
	arr2 . sort ( )
	for i in range ( n ) :
		if ( i < k ) :
			arr [ i ] = arr1 [ i ]
		else :
			arr [ i ] = arr2 [ len2 - 1 ]
			len2 -= 1
	for i in range ( n ) :
		print ( arr [ i ] , end = " ▁ " )
if __name__ == " _ _ main _ _ " :
	arr = [ 5 , 4 , 6 , 2 , 1 , 3 , 8 , 9 , - 1 ]
	k = 4
	n = len ( arr )
	printOrder ( arr , n , k )