Question: help please i don't understand this java code. please help me fully understand and what is ? and : i have never seen this symbol

help please i don't understand this java code. please help me fully understand and what is ? and : i have never seen this symbol before

public class mergesort {

public static void main(String[] args) {

int[] intArray = { 20, 35, -15, 7, 55, 1, -22 };

mergeSort(intArray, 0, intArray.length);

for (int i = 0; i < intArray.length; i++) {

System.out.println(intArray[i]);

}

}

// { 20, 35, -15, 7, 55, 1, -22 }

public static void mergeSort(int[] input, int start, int end) {

if (end - start < 2) {

return;

}

int mid = (start + end) / 2;

mergeSort(input, start, mid);

mergeSort(input, mid, end);

merge(input, start, mid, end);

}

// { 20, 35, -15, 7, 55, 1, -22 }

public static void merge(int[] input, int start, int mid, int end) {

if (input[mid - 1] <= input[mid]) {

return;

}

int i = start;

int j = mid;

int tempIndex = 0;

int[] temp = new int[end - start];

while (i < mid && j < end) {

temp[tempIndex++] = input[i] <= input[j] ? input[i++] : input[j++];

}

System.arraycopy(input, i, input, start + tempIndex, mid - i);

System.arraycopy(temp, 0, input, start, tempIndex);

}

}

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!