You've been given a divide-and-conquer algorithm which merges k sorted lists recursively.
Currently the time complexity of the algorithm is worst case O(k*N), where k is the number of lists and N is the total number of nodes in all lists combined. This time complexity is the result of the pattern of recursion used (the order in which the linked lists are merged).
Your task is to change the recursion such that the time complexity decreases to worst case O(NLogk). Achieve this by ONLY making changes in the mergekLists function or creating your own function. Do NOT make changes in the merge function.
Code is available in C++, Java and Python. Make changes in the file with the language of your choice.