I did. I'm just having fun with the sloppy problem statement. If you
don't ask for what you want you might get what you ask for rather than
what you had in mind. The solver might decide that the OP really meant
something different, and solve some other problem, which may or may
not be what was intended. The infinite list was not the only thing
which was not well specified. "Random node" could mean any of a number
of things. What makes one node any more random than another?

Don

On Jan 3, 6:51 pm, Dave <[email protected]> wrote:
> @Don: You did, of course, see the OP's revision 
> inhttps://groups.google.com/d/msg/algogeeks/Be3WBebCDCk/_Mb0HUQ93WoJ, did you
> not?
>
> Dave
>
>
>
>
>
>
>
> On Thursday, January 3, 2013 3:08:40 PM UTC-6, Don wrote:
> > The spec says that the list is infinite, so I don't think that is
> > possible in finite time.
> > Don
>
> > On Jan 2, 7:53 pm, Dave <[email protected]> wrote:
> > > @Don: HaHa. That's cute, but don't you really think the problem is to
> > > return any node in the list with equal probability?
>
> > > Dave
>
> > > On Wednesday, January 2, 2013 4:48:15 PM UTC-6, Don wrote:
> > > > Why not just return the first node? That is as random as any other
> > > > node.
> > > > Don
>
> > > > On Dec 27 2012, 5:01 am, naveen shukla
> > > > <[email protected]> wrote:
> > > > > Given a linked list of infinite length. Write a function to return a
> > > > random
> > > > > node.
>
> > > > > Constraints:
>
> > > > > 1 You can traverse a singly linked list only once.
> > > > > 2 You can not use any extra space.
>
> > > > > Thanks in advance.

-- 


Reply via email to