Circular linked list

my code is not run and i am not able to find my error

You just keep taking inputs in the same manner as you did in the others(i.e. insertion at the tail) until you get an element which is already present in the list , in such case you need to check wheather the further elements are same if yess then point the last node to the matching node , else keep taking input .

Actually this question is for inputs having no dublicates . So no need for so much calculation . just store alll the elements and start traversing the list until u get the element which has already occurred before.

thanks but i use same logic that is used in video still my code is not running
so can you check my code and help me where i am doing mistake

line 40 will be
while(temp->next!=head)

and not
while(temp->next!=NULL)

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.

1 Like