linked list with cycle structure

David Hláčik david at
Wed Jan 7 23:13:57 CET 2009


so okay, i will create a helping set, where i will be adding elements
ID, when element ID will be allready in my helping set i will stop and
count number of elements in helping set. This is how long my cycled
linked list is.

But what if i have another condition , and that is *i can use only
helping memory with constant size* ? This means i am not able to
create any set and adding elements there. I need to have a constant
size variables . This is complication a complication for me.

Thanks in advance!


On Wed, Jan 7, 2009 at 2:22 PM, Diez B. Roggisch <deets at> wrote:
> David Hláčik wrote:
> > dictionary with cycle structure
> >
> > 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.
> > Yes , maybe it sounds strange, but we need to implement this and i
> > would be very gladfull for your toughts.
> Time for homework again? Last time sorting in O(n), now this. How about you
> try something yourself and show us the results - then we might comment on
> enhancements or problems.
> Diez
> --

More information about the Python-list mailing list