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 are three common types of traversals?
Explain the Array
What are the advantages and disadvantages of linked list over array?
What is the Insertion Sort Code?.
Define an equivalence relation?
Program to remove duplicate elements in an array.
Why do we need arrays if all the operations that are performed on arrays can be performed on arraylist?
What is bubble sort and quick sort?
What is a reverse linked list.
How many null values are allowed in hashmap?
How do you do binary search?
Does list maintain insertion order?