Doubly linked list creation


plz correct the code and explain as well…

Hey @S19LPPP0202, your code is absolutely correct what you were missing is cur=cur->next in line number 45.
I have debugged your code here : https://ide.codingblocks.com/s/330931
Hope it will help you :smile:

how to traverse doubly linked list using the prev pointer as it will help to rtraverse in reverse manner ??


i have returned the prev pointer in createll function…
plz correct this code…it doesnt show output …

Hey @S19LPPP0202 the code you wrote is not applicable to reverse a double linked list in reverse order, moreover you are also not updating your prev node with iteration on elements so that the previous node is the last element of the linked list as per your approach. Moreover the print function you have designed do’s an operation
cout<data and
node=node->next, which means it will print order by traversing in forward order, not in backward. So you have to design a new function to print reverse of a linked list.
I’ll suggest you to form another algorithm and do as per that implementation.
Hope you got your mistake :smile: Keep coding :+1:

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.