If left is smaller than right then there is a 1 at left and a 0 at right . Exchange arr [ left ] and arr [ right ]
if left < right : NEW_LINE INDENT arr [ left ] = 0 NEW_LINE arr [ right ] = 1 NEW_LINE left += 1 NEW_LINE right -= 1 NEW_LINE DEDENT return arr NEW_LINE