package
Version:
v0.0.0-...-db5e768
Opens a new window with list of versions in this module.
Published: Jul 25, 2019
License: MIT
Opens a new window with license information.
Imports: 0
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
题目
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.
解题思路
最先想到的方案是,依次合并res=merge(res, lists[i]),这个方案的坏处是需要合并两个长度相差很大的链。
LeetCode上最快的解决方法是,借鉴了归并排序的思想,让lists中临近的list先两两合并,再让新生成的lists中的临近list两两合并,直到合并完成。
总结
Documentation
¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.