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 the difference between file structure and storage structure?
Does hashset allow duplicates?
Does map extend iterable?
simple algorithm for bubble sort?
What is difference between arraylist and list?
Write the procedure to convert general tree to binary tree?
Is bucket sort a comparison sort?
Write a program to insert an element and in the specific position in the array?
What is the purpose of tochararray ()?
What is dequeue operation?
What is data structure in programming language?
What are some of the best practices relating to the java collection framework?