rearrangement of array from negative to positive in java
Answers
Answered by
2
Answer:
Declare an array and input the array elements. Start traversing the array and if the current element is negative,swap the current element with the first positive element and continue traversing until all the elements have been encountered. Print the rearranged array.
Answered by
0
Answer:
Given an array of positive and negative numbers, arrange them in an alternate fashion such that every positive number is followed by negative and vice-versa maintaining the order of appearance. Number of positive and negative numbers need not be equal
Explanation:
Similar questions