When we do swapping of head and tail

when we do swapping of head and tail, we are swapping the whole node , so why does the data also doesn’t get swapped(10 and 50)

the head and tail are pointers. head points to first node, tail points to last node. when we swap pointers, they will start pointing to different nodes, like head now points to last node while tail points to first node… nodes are not being swapped.

this is like int a =10,b=20; int *p = &a; p = &b;
here a is still same, but p now points to b.

thanks

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.