Is it possible to join two Doubly linked lists into a Single linked list? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to join two Doubly linked lists into a Single linked list?

If it is possible please give a short example.And if u can Pseudo code for how they can be joined..Thankyou in advance

7th May 2020, 11:53 AM
Nica STRAIT
Nica STRAIT - avatar
4 Answers
+ 2
Yes but you will have to browse the old one the first list and add the elements of this one in the second with .add
7th May 2020, 12:08 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 2
Not I am said take elements of list1 then put in the list2
7th May 2020, 12:52 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar
+ 1
THANKS can u give me like a short description step by step how the pointers will point to the next node and so on to join the two lists.I just need to know the algorithm only Thanks
7th May 2020, 12:12 PM
Nica STRAIT
Nica STRAIT - avatar
0
If you have 02 tracks let's call list1 and list 2 And want to add the elements of list1 in list2 with list1.size () I have the size of the array then I use a strong mouth and for each element of list1 I do list2.add (list1.get (x)); X being the index of the for loop
7th May 2020, 12:17 PM
HEUBA BATOMEN Franck Duval
HEUBA BATOMEN Franck Duval - avatar