int[] a = {6, 3, 8, 5, 2, 7, 4, 1};
int mid = a.length / 2;
int[] left = new int[mid];
int[] right = new int[a.length - mid];
for (int i = 0; i < mid; i++) left[i] = a[i];
for (int i = mid; i < a.length; i++) right[i - mid] = a[i];What is right after the divide step?
- A
{1, 4, 7, 2}
- B
{6, 3, 8, 5}
- C
{6, 3, 8, 5, 2, 7, 4, 1}
- Dcheck_circle
{2, 7, 4, 1}
Explanation
The right half of an 8-element array is the second 4 elements.