Given below is the pseudocode of floyd's cycle detection algorithm. Which of the following best suits the blank?
Start traversing the linked list using two pointers
move one pointer with . . . . . . . .
if pointers meet at any node
{
loop exists in the linked list
}
else
{
linked list doesn’t have a loop
}
if pointers meet at any node
{
loop exists in the linked list
}
else
{
linked list doesn’t have a loop
}
A. same speed
B. one fourth the speed of another
C. twice the speed of another
D. thrice the speed of another
Answer: Option C
Join The Discussion