1. Write a procedure swap() to interchange the items present in the ith and jth
location of an array A[].
Answers
Answered by
3
Explanation:
I've been trying to work this out:
Say I have an array:
int[] n = {0, 0, -1, 1, 0, 1, 1, -1, 1};
I need to be able to sort through the array and if there is a zero with a non zero preceding it, then they should be swapped.
For example: 0, 0, -1, 1, 0, 1, 1, -1, 1
will become: 0, 0, -1, 0, 1, 1, 1, -1, 1
I have been trying to do it using a for loop and if statements with no luck. Any tips?
Answered by
1
Explanation:
ok dear I will answer but my phone battery is 1% I can't answer first I will charge it then I will answer your question
Similar questions