Please help me in this code i am trying to implement floyyds cycle
Hi @Namanjain123
Mistake that you are making is in push function where you are checking if that data is already present or not and then making a loop for it. But it goes wrong because once you have created a loop you are again taking an input and again creating a loop. Instead you should make push function as a bool function and once you have created a loop then just return false and in the main when you encounter a false you can just break that while loop.
Here is the corrected code, have a look.