please check this function
****************floyd's cycle
hey,
slow is not defined
secondly, once u found where fast and slow are equal
then again u have to loop over it, to find the second occurance where they are cycle and break the cycle at that point
divide it in two diff steps
first simply find when slow == fast and break it
now put slow to head and fast where it originally was
in the next loop
run it till fast!=slow
and increment both by just one step
and when the loop breaks make the prev element’s next as null
hey, tail is not defined
and in the second loop
idk what you are doing
do this instead,
store a previous = fast
now increment fast and increment slow
if the become equal break
make previous’s next = null
i have not used tail anywhere