On Wed, Jan 7, 2009 at 5:59 AM, David Hláčik <da...@hlacik.eu> wrote: > Hello guys, > > I have a linked list where *number of elements is unlimited* and > **last element points on random (can be first, last, in middle , > anywhere) element within linked list** - this is important . My goals > is to create an architecture /scheme for **algoritmus which will count > total number of elements** of such linked list.
So the list is effectively endless because it has a cycle? You could walk the list, adding elements (or their ids) to a set, stopping when you get to an element that is in the set already. Then the size of the set is the size of the list. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor