UNPKG

algopat

Version:

Utility library for implementing common design patterns and algorithms

18 lines 638 B
export type InsertionSortOptions = { mutable: boolean; }; /** * Performs an in-place insertion sort on the given array. * @param arr The array to sort. * @param compareFn The function to compare two elements. * @param options The options for the insertion sort. * @returns The sorted array (same reference as input). * * @example * const arr = [5, 3, 8, 4, 2]; * const sorted = insertionSort(arr); * console.log(sorted); // [2, 3, 4, 5, 8] * */ export declare const insertionSort: <T>(arr: T[], compareFn?: (a: T, b: T) => number, options?: InsertionSortOptions) => T[]; //# sourceMappingURL=insert-sort.algorithm.d.ts.map