﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Algs4.Helper.SortHelper;

namespace Algs4.Algorithms
{
    public class InsertionSort
    {
        public static void sort<T>(List<T> list)
        {
            for (int i = 0; i < list.Count; i++)
            {
                for (int j = i; j > 0; j--)
                {
                    if (less(list[j], list[j - 1]))
                    {
                        exch(list, j, j - 1);
                    }
                }
            }
        }
    }
}
