I need a method that takes a linkedlist as a parameter and return true or false if it is circular or not.
ex:circular linkedlist means there is node pointes to any previous node. I forgot to tell some constraints, I can not use any datastructure or dynmaic memory allocations. I can use local variables only and the alogrithm can be done in n steps as someone said to me (I am thinking now to use two pointers?)
I believe you’re looking for Floyd’s Cycle-Finding Algorithm. There’s a better explanation than I could give of it over here.
There are also a couple of implementations in C and Scheme with documentation over here.