What if there are 2 nodes with same value and we want the second node?
What if there are 2 nodes with same value and we want the second node?
you want 2nd means you want to search 2nd one
or
want to delete 2nd one
or any other thing
please explain your doubt
If we have to perform any operation on the second node . First We have to iterate to it na? so how can we Iterate to second node or third node containing the same value?
for this iterator in list
and make a variable temp
if (node->data==d ) temp=node;
after iterating you have the last occurence of d
if you want all occurences
make a vector
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.