📜  给出一个 O (n lg k) 时间算法将 k 个排序列表合并为一个排序列表 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:31.640000             🧑  作者: Mango

代码示例1
Analysis: It takes O(k) to build the heap; for every element, it takes O(lg k) to DeleteMin
and O(lg k) to insert the next one from the same list. In total it takes O(k + n lg k) =
O(n lg k).