I know the normal way of doing this, i.e, without using list STL , but how do we do it using list STL (I’m having problem with what to pass in the merge function using this STL)…
This is the link to my code using list STL— https://ide.codingblocks.com/s/360083
Also please tell me what’s wrong with this code…
Doubt with implementation
Hey @chaturvedia336, To merge a Linked list using stl function you don’t have to write such long functions .
You can just write suppose the two lists are list1 and list2
then the merge function is list1.merge(list2);
Hope it helps! Happy Coding!
If you do not have any further doubts then please mark this doubt as resolved:)
I tried attempting this without STL, here’s the code–https://ide.codingblocks.com/s/360281 , what’s wrong with this code?
Can somebody please reply to my query?.. I’m not able to do this question without STL(here is the code link–https://ide.codingblocks.com/s/360281). Please tell me what’s wrong?
hello @chaturvedia336

a) correct ur insert function
u dont have to insert node on head ,instead u need to insert it in tail
b) that while loop in line 26 , will read all integers , i.e u will not left with any input for 2 nd list.
so dont use it . istead read number of data in first list ,and then iterate that many times to build the list
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.