This function sorts array from left index to to right index which is of size atmost RUN
def insertionSort ( arr , left , right ) : NEW_LINE INDENT for i in range ( left + 1 , right + 1 ) : NEW_LINE INDENT j = i NEW_LINE while j > left and arr [ j ] < arr [ j - 1 ] : NEW_LINE INDENT arr [ j ] , arr [ j - 1 ] = arr [ j - 1 ] , arr [ j ] NEW_LINE j -= 1 NEW_LINE DEDENT DEDENT DEDENT