We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hi D_K, I just wonder if your code will compare the remaining of class A in case B is all null already, but A is still unsorted ?
because I see you only compare A and B, and when B is null, such as when A has 10 elements and B has only 1 element, program just stop after pushing that one element of B into minimal position in A without going further and sort A.
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
Hi D_K, I just wonder if your code will compare the remaining of class A in case B is all null already, but A is still unsorted ? because I see you only compare A and B, and when B is null, such as when A has 10 elements and B has only 1 element, program just stop after pushing that one element of B into minimal position in A without going further and sort A.
It is correct in case A is already sorted tho.
The question says A and B are already sorted.