I have to write a function of the following method :
Rejection method (uniform envelope):
Suppose that fx is non-zero only on [a, b], and fx ≤ k.
Inside while loop, if we have return statement with true or false.. it will work accordingly..
Example: To Check a list is circular or not..
here the loop is infinite, because while (true) is true always, but we can break sometimes by using the return statement,.
while(true)
{
if(!faster || !faster->next)
return false;
else
if(faster==slower || faster->next=slower)
{
printf("the List is Circular\n");
break;
}
else
{
slower = slower->next;
faster = faster->next->next;
}