OK. I got this on the net. Too good. Time complexity is also O(n). findloophead(x, y) { a = x b = y while (next(a) != b) { /* while b is not loop head */ t = midpoint(a, b) if (find(next(y), t, b)) { /* if t is in the loop */ b = t else a = t } return(b) }
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---