How Do You Separate An Even And Odd Number In An Array?
How Do You Separate An Even And Odd Number In An Array? Initialise two index variable , left=0 and right=arr.length-1. Increment left variable until you get odd number. Decrement right variable until you get even number. If left < right, swap arr[left] and arr[right] In the end, you will see that you have even numbers