human
Find k maximum elements of array in original order | Function to pr m Maximum elements.
vector to store the copy of the original array.
Sorting the vector in descending order . Please refer below link for details.
Traversing through original array and pring all those elements that are in first k of sorted vector ..
Driver code"
How can the above be solved in Python?
 Write me a code to find k maximum elements of array in original order and the other steps required?
assistant
#Here is code to find k maximum elements of array in original order and the other steps required.
 def printMax ( arr , k , n ) :
	brr = arr . copy ( )
	brr . sort ( reverse = True )
	for i in range ( n ) :
		if ( arr [ i ] in brr [ 0 : k ] ) :
			print ( arr [ i ] , end = " ▁ " )
arr = [ 50 , 8 , 45 , 12 , 25 , 40 , 84 ]
n = len ( arr )
k = 3
printMax ( arr , k , n )