5 ms·
> If the list size is known, it's very easy to construct a hash table or hash set If the list size is known, you already know there's not a cycle.
by jemfinch 17y ago
> If the list size is known, it's very easy to construct a hash table or hash set
If the list size is known, you already know there's not a cycle.
- keefe 17y agonot necessarily : here's a file or chunk of memory that's 10MB in size representing a list, is there a cycle? that's a different problem than an infinite sequence of integers.
- jemfinch 17y ago(I know this was 17 days ago, but I just noticed this comment). Being contained in a finite amount of memory does not give a list a size. Lists with cycles may take up a number of nodes, but saying they have a "size," despite the fact that you can iterate over them infinitely and never reach the end, is oxymoronic. An infinite sequence (which a list with a cycle is) has no size.