Linked List 4 - Others
Merge k sorted linked lists and return it as one sorted list.
Analyze and describe its complexity. N is the totle numbers.
Merge lists two by two I: 顺序merge, O(Nk),平均每个点都得合并K次
Merge lists two by two II: 两两merge, O(Nlogk),每个点合并logk次
Divide Conquer: 上一解法的递归版,O(Nlogk),每个点合并logk次
Priority Queue(Heap): 推荐做法,K个元素的最小堆,平均每个点进出堆1次, O(Nlogk)
传统的hash map方法: