Definition at line 17 of file main.cpp.
◆ mergeKLists()
Definition at line 28 of file main.cpp.
29 {
30 if (lists.empty())
31 return NULL;
32 priority_queue<ListNode*, vector<ListNode*>, Comparator> min_heap;
34 {
35 if (head == NULL)
36 continue;
38 while (current != NULL)
39 {
40 min_heap.push(current);
41 current = current->
next;
42 }
43 }
44 if (min_heap.empty())
45 return NULL;
47 min_heap.pop();
49 while (!min_heap.empty())
50 {
51 current->
next = min_heap.top();
52 min_heap.pop();
53 current = current->
next;
54 }
56 return head;
57 }
Definition for singly-linked list.
References ListNode::next.
The documentation for this class was generated from the following file: