MERGE TWO SORTED LINKED LIST

If I take T=2. It is running perfectly for the first time but getting infinite in second.

@mverma_be19 initialise head1 and head2 as NULL for each test case

Okay now it working correctly for small number of inputs

But when I try providing input of numbers from 1-100 it gives only 50 and 100. Why so?

@mverma_be19 your earlier doubt was for merging two sorted linked lists, i think the latest code is for merge sort.

Yeah actually it was posted by mistake. That’s why I have already marked it as resolved

1 Like