Re: linked list with cycle structure

2009-01-08 Thread David Hláčik
Hi, well i am able to find a loop in a list using two iterators.One iterator runs "two times faster than the other", and if he encounters the first, it means that there is a loop. Example : 1,2,3,4,5,6,7,8,9,5 the algorithm would generate: start - 1,2 iteration 1- 2, 4 iteration 2- 3, 6 iteratio

Re: linked list with cycle structure

2009-01-08 Thread Diez B. Roggisch
David Hláčik wrote: > Hi, > > 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 condi

Re: linked list with cycle structure

2009-01-07 Thread Robert Kern
Terry Reedy wrote: David Hláčik wrote: 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

Re: linked list with cycle structure

2009-01-07 Thread Terry Reedy
David Hláčik wrote: 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. CPython now does this in printing and marshalling

Re: linked list with cycle structure

2009-01-07 Thread David Hláčik
Hi, 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 h

Re: linked list with cycle structure

2009-01-07 Thread Diez B. Roggisch
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

linked list with cycle structure

2009-01-07 Thread David Hláčik
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