kMerge
k-way merge implementation that merges (and potentially sorts) k individually sorted arrays based on the k-way merge algorithm (https://en.wikipedia.org/wiki/K-way_merge_algorithm)
If a comparator function used to compare data is provided, a k-way merge sort is performed using a Binary Heap implementation. Otherwise data from each input array is merged incrementally
The returned object contains merged (and potentially sorted) data, as well as key-value pairs that represent the index of a result set in the "data" parameter (the key) tied to how many results (the value) of that result set were added to the final merged data array. For example, if "data" represents an array of two result sets, with 3 and 5 results added to the final result set, respectively, the returned object would be { data: [...], "0": 3, "1": 5 }
Parameters
Returns
list of results and key-value pairs indicating how many from each were added to returned data
- data:
- []
Function defined in search/src/util/merge-sort/merge.ts:34