Skip to content

Instantly share code, notes, and snippets.

View sarb1208's full-sized avatar

Sarabjyot Singh sarb1208

View GitHub Profile
@sarb1208
sarb1208 / loop.c
Created August 1, 2018 19:09
Following is C code snippet for detecting a cycle in a singly linked list
/*The structure of linked list is the following
struct node
{
int data;
node* next;
};*/
int detectloop(struct node *list){
// your code goes here
if(list==0)
return 0;