How we can make a linked list which contain cycle

I am not able to understand how to make a linked list which contain cycle?

  1. you have to take one parameter (int m) value where cycle have to be created
  2. now iterate on linked list and if you get m then store it in a variable temp
  3. go to end of linked list set it pointer to m’s address store in temp rather than NULL
    in this way you can create a cycle starting from m