How can one find a cycle in the linked list? IF found how
to recognize the cycle and delete that cycle?
Answers were Sorted based on User's Feedback
Answer / riddle
I dont think answer #8 is any recursive verion .....
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / rajdeep...
void cycle_detect(struct node *head)
{
struct node *ptr1=head;
struct node *ptr2=head;
while(ptr1!=NULL && ptr1->next!=ptr2)
{
ptr1=ptr1->next;
}
if(ptr1->next==ptr2)
{
printf("the list contains cycle");
}
else
{
printf("the list don't contain cycle");
}
}
| Is This Answer Correct ? | 6 Yes | 16 No |
What is priority queue in data structure?
Can arraylist be empty?
simple algorithm for bubble sort?
What is array simple?
Explain binary search tree?
How do you sort an arraylist in descending order?
What type of data structure is used to perform recursion?
Can we use any class as map key?
What is stack push?
What are data members?
What is bubble sort in data structure?
What is the height of binary tree?