human
Check if given array is almost sorted ( elements are at | Function for checking almost sort.
One by one compare adjacents ..
check whether resultant is sorted or not.
Is resultant is sorted return true.
Driver Code"
Solution in Python:
 ... Give me a code to check if given array is almost sorted ( elements are at and the other steps required?
assistant
#Here is code to check if given array is almost sorted ( elements are at and the other steps required.
 def almostSort ( A , n ) :
	i = 0
	while i < n - 1 :
		if A [ i ] > A [ i + 1 ] :
			A [ i ] , A [ i + 1 ] = A [ i + 1 ] , A [ i ]
			i += 1
		i += 1
	for i in range ( 0 , n - 1 ) :
		if A [ i ] > A [ i + 1 ] :
			return False
	return True
if __name__ == " _ _ main _ _ " :
	A = [ 1 , 3 , 2 , 4 , 6 , 5 ]
	n = len ( A )
	if almostSort ( A , n ) :
		print ( " Yes " )
	else :
		print ( " No " )