UNPKG

algopat

Version:

Utility library for implementing common design patterns and algorithms

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