Wrong answer through this code

i am not getting answer through this code… i think there is some issue with this can you help me solving out this?
here is my code

hello @aditikandhway
ur doubt is related to which question?

pls mention the name of the problem

circular linked list.in this question i have to break the cycle of the circular linked list

ok ,pls share correct code link .
u have shared code link of remove dupicated nodes

i have used the concept of remove duplicates in this code. first i have sorted the list and then removed the duplicated elements

no that is not correct way of doing it.

a) sorting will chnage the order . which we dont want.

b) removing duplicate is not sufficient to remove cycle.

u need to find that is responsible for cycle formation and then u have to remove this cycle by assigning null to the next of this detected node.