﻿namespace SorthingAlgorithms
{
    public static class SelectionSorter
    {
        public static void Sort(int[] array)
        {
            int positionOfMin;
            int temp;

            for (int i = 0; i < array.Length - 1; i++)
            {
                positionOfMin = i;

                for (int j = i + 1; j < array.Length; j++)
                {
                    if (array[j] < array[positionOfMin])
                    {
                        positionOfMin = j;
                    }
                }

                temp = array[positionOfMin];
                array[positionOfMin] = array[i];
                array[i] = temp;
            }
        }
    }
}
