Driver program to test above
var arr = [ 0 , 2 , 2 , 2 , 0 , 6 , 6 , 0 , 0 , 8 ] ; var n = arr . length ; document . write ( " " ) ; printArray ( arr , n ) ; modifyAndRearrangeArr ( arr , n ) ; document . write ( " " ) ; document . write ( " " ) ; printArray ( arr , n ) ;