Closed notmaster closed 4 years ago
合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。 示例:
输入: [ 1->4->5, 1->3->4, 2->6 ] 输出: 1->1->2->3->4->4->5->6
存储空间因为没有开辟新地址,所以O(1)最优。数据比较时完全是暴力计算,实际上可以更小。后续抽空优化。 (https://leetcode-cn.com/problems/merge-k-sorted-lists/submissions/)[https://leetcode-cn.com/problems/merge-k-sorted-lists/submissions/]
面试题 17.12. BiNode : 二叉树转顺序单链表 : DFS+避开javascript浅拷贝 https://leetcode-cn.com/problems/binode-lcci/solution/er-cha-shu-de-mo-shi-atom-left-thisval-right-left-/