```
import java.util.ArrayList;
import java.util.Arrays;
public class SearcherAndSorter
{
private ArrayList<Integer> values;
private int counter;
public SearcherAndSorter()
{
values = new ArrayList<Integer>();
}
private void insert(int value, int[] sorted, int count)
{
/*for(int j = 0; j < values.size(); j++)
{
count++;
if(value < values.get(j))
{
values.add(j, value);
return;
}
}
values.add(value);*/
int lastValue = 0;
sorted[count] = value;
for(int i = count-1; i >= 0; i--)
{
counter++;
if(value < sorted[i])
{
lastValue = sorted[i];
sorted[i+1] = lastValue;
sorted[i] = value;
}
}
System.out.println("Inserted " + value + " size " + (count+1));
for(int j = 0; j < count + 1; j++)
{
System.out.println(sorted[j]);
}
System.out.println("Done!");
}
/*
* Insertion sort
*/
public int[] sort(int[] val)
{
int[] values = new int[val.length];
for(int i = 0; i < val.length; i++)
{
insert(val[i], values, i);
}
System.out.println(counter);
return values;
}
/*
* Selection sort
*/
public int[] sortTwo(int[] val)
{
int count = 0;
int[] value = val;
for(int i = 0; i < value.length - 1; i++)
{
count++;
int minIndex = i;
for(int j = i + 1; j < value.length; j++)
{
if(value[minIndex] > value[j])
{
minIndex = j;
}
}
if(minIndex != i)
{
int lastValue = value[i];
value[i] = value[minIndex];
value[minIndex] = lastValue;
}
}
//System.out.println("Number of times the for loops run for: " + count);
return value;
}
public int[] sortThree(int[] val)
{
if(val.length <= 1)
{
return val;
}
int[] valOne = new int[val.length/2];
int[] valTwo = new int[val.length - valOne.length];
for(int i = 0; i < valOne.length; i++)
{
valOne[i] = val[i];
}
for(int n = valOne.length; n < valTwo.length; n++)
{
valTwo[n - valOne.length] = val[n];
}
sortThree(valOne);
sortThree(valTwo);
while()
{
int indexOne = 0;
int indexTwo = 0;
int arrayIndex = 0;
if(valOne[indexOne] < valTwo[indexTwo])
{
}
}
return val;
}
@Override
public String toString()
{
String value = "";
for(int i = 0; i < values.size(); i++)
{
value = value + values.get(i) + " ";
}
//System.out.println(count);
return value;
}
```

}

I haven't finished the sortThree. it is a merge sort. I am not sure how to do it so I need a little starting help. And no there shouldn't be changes to anything else other than the while loop in the sort three. thanks for the help