Moderate# Identifying the Sort Algorithm and Number of Passes 1

APCSA-DVGYEN

Consider the following sort method.

```
public static void sorter( double[] nums)
{
for (int i=1; i< nums.length; i++)
{
double curr = nums[i];
int j=i;
while(j>0 && curr < nums[j-1])
{
nums[j] = nums[j-1];
j--;
}
nums[j] = curr;
}
}
```

What type of sort algorithm is this method using and how many passes through the for loop will it take to sort the following array?

```
double[] nums = {52.3, 20.25, 5.52, 20.5, 67.45, 10.81};
sorter(nums);
```