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.
--
calll Simple
Random(head);
On Thu, Dec 27, 2012 at 3:31 PM, naveen shukla
naveenshuklasweetdrea...@gmail.com wrote:
random node
--
--
With Best Wishes
From:
Naveen Shukla
IIIT Allahabad
B.Tech IT 4th year
Mob No: 07860896972
E-mail naveenshuklasweetdrea...@gmail.com
--
algo using new random number r1;
On Thu, Dec 27, 2012 at 4:12 PM, Vineeth vineeth.n...@gmail.com wrote:
You said : Given a linked list of infinite length
On Thu, Dec 27, 2012 at 4:06 PM, naveen shukla
naveenshuklasweetdrea...@gmail.com wrote:
But suppose a random number generate a value
will be completely
random.
Please reply in case u still have some doubt.
Thanks
On Fri, Dec 28, 2012 at 10:48 AM, naveen shukla
naveenshuklasweetdrea...@gmail.com wrote:
i mean the length of the linked list is not known to us.
@udit how can we do this in single traversal ? i think we need
?hl=en.
--
From:
Naveen Shukla
IIIT Allahabad
B.Tech IT 2nd year
Mob No: 07860896972
E-mail rit2009...@iiita.ac.in
naveenshuklasweetdrea...@gmail.com
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email