Can you pls tell why my code is showing TLE?https://ide.codingblocks.com/s/107169
Merge sort linked list TLE
hey @urvigoel26, Is it giving TLE when you submitting this code in question or when you are just in running in CB ide.
if you are submitting this code in question then remember that the question is asking for testcase, size of a first linked list, then element of linked list then size of second linked list and then elements of second inked list. And your input format is not according to question.
It is giving TLE on submitting the code. And acc to the question, the input just contains the size of linked list and then the elements of the linked list. https://hack.codingblocks.com/contests/c/917/546
I think you are understanding the wrong question . The question is merge sort a linked list and not just merge two linked lists. https://hack.codingblocks.com/contests/c/917/546
Hey @urvigoel26, this doubt is indicated for this question only. Although I have modify your code for mergesort question https://ide.codingblocks.com/s/107550. But it is still giving TLE because for all testcases N=20,000 and compiler is not able make linked list for such a high number. This code is giving correct answer for smaller inputs. I suggest you to use array for storing the values and apply merge sort on array.