Question: ******** In JAVA ******* Given an array A, push all the zeros of the array to the front. The order of all other elements should

******** In JAVA *******

Given an array A, push all the zeros of the array to the front. The order of all other elements should remain same.

Write a function: void pushZero(int[] A, int N)

that accepts an integer array A and size of the array, N. The function should convert the original array as per above requirement.

Input 10 2 0 3 4 0 4 0 10 9 0

where,

First line represents size of an array N.

Second line represents array elements. There must be single space between each element.

There should be one space after the last element.

Output 0 0 0 0 2 3 4 4 10 9

There must be single space between each element of output array.

There should be one space after the last element.

N is an integer within the range [1 to 1,000,000].

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!