human
Maximum and minimum of an array using minimum number of comparisons | getMinMax ( ).
If array has even number of elements then initialize the first two elements as minimum and maximum.
set the starting index for loop.
If array has odd number of elements then initialize the first element as minimum and maximum.
set the starting index for loop.
In the while loop , pick elements in pair and compare the pair with max and min so far.
Increment the index by 2 as two elements are processed in loop.
Driver Code"
Solution in Python:

=====
Write me a code to maximum and minimum of an array using minimum number of comparisons and the other steps required?
assistant
#Here is code to maximum and minimum of an array using minimum number of comparisons and the other steps required.
 def getMinMax ( arr ) :
	n = len ( arr )
	if ( n % 2 == 0 ) :
		mx = max ( arr [ 0 ] , arr [ 1 ] )
		mn = min ( arr [ 0 ] , arr [ 1 ] )
		i = 2
	else :
		mx = mn = arr [ 0 ]
		i = 1
	while ( i < n - 1 ) :
		if arr [ i ] < arr [ i + 1 ] :
			mx = max ( mx , arr [ i + 1 ] )
			mn = min ( mn , arr [ i ] )
		else :
			mx = max ( mx , arr [ i ] )
			mn = min ( mn , arr [ i + 1 ] )
		i += 2
	return ( mx , mn )
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1000 , 11 , 445 , 1 , 330 , 3000 ]
	mx , mn = getMinMax ( arr )
	print ( " Minimum ▁ element ▁ is " , mn )
	print ( " Maximum ▁ element ▁ is " , mx )