Write a Java program to segregate all 0s on left side and all 1s on right side of a given array of 0s and 1s
belongs to collection: Array Programs in Java with Examples
All Answers
total answers (1)
belongs to collection: Array Programs in Java with Examples
total answers (1)
In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..
Result:
Original Array : [1, 1, 0, 1,0, 1, 1, 1, 0, 0, 0]
Array after segregation is : [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1]