in Programming in C
555 views
2 votes
2 votes

in Programming in C
555 views

1 Answer

0 votes
0 votes

Try to solve taking a list having loop in the list otherwise it will give true whether it is even or odd no of nodes in the list.
Now It will return false when loop is detected because pointer B runs twice fast than pointer A. So after sometime pointer A will catch pointer B and B!=A become faulty and return false because there is B==null condition always faulty.Since there is loop in the list then B can't have null.
 


 

3 Comments

It will return false if  there is loop in the list .

0
0
it return true when length is even
0
0
It always return true whether length is even or odd if there is no loop in the list.
1
1