Answer the question
In order to leave comments, you need to log in
Why is the body of the loop being lit?
static void insert(int[] array, int pos, int index) {
int num = array[index];
for (int i = pos + 1; i < index; i++) {
int a = array[i];
array[i] = array[i - 1];
array[i] = a;
}
array[pos] = num;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question