Merge k Sorted Lists
hardMerge k sorted linked lists into one sorted linked list using divide and conquer
Merge K Sorted Lists
Key Insight
Divide-and-conquer: merge pairs of lists, halving the count each round
Step 1Initial K=3 Lists
List 0: [1,4,5]List 1: [1,3,4]List 2: [2,6]
1
4
5
null
List 2
1
3
4
null
New nodes
2
6
Three sorted lists: [1,4,5], [1,3,4], and [2,6].
1 / 5