Move all the negative elements to one side of the array
def rearrange(arr):
low = 0
high = 0
while high<len(arr):
if (arr[high] < 0):
arr[high], arr[low] = arr[low] , arr[high]
low += 1
high += 1
print(arr)
# Driver code
arr = [-1, 2, -3, 4, 5, 6, -7, 8, 9]
rearrange(arr)
#Output -> [-1, -3, -7, 4, 5, 6, 2, 8, 9]