Moderate# Identifying the Sort Algorithm and Number of Passes 2

APCSA-F4PPXF

Consider the following sort method.

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

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 = {40, 20.1, 5, 20.5, 10};
sorter(nums);
```