fixed dplicate and working on reverse
done with detecting cycle function
started reverse functions