Skip to content

Instantly share code, notes, and snippets.

/**
* Sorts a subrange of values in an array of Comparable objects using Insertion Sort
* @param data - The array to be sorted
* @param start - Beginning index, inclusive
* @param end - Ending index, inclusive
*/
public static <T extends Comparable<? super T>> void insertionSort(T[] data, int start, int end)
{
for(int i = start; i <= end; i++)
{