Pergunta de entrevista da empresa Microsoft

You've a singly linked list where every node in the list has a field "random" which points to other node in the same list. Write a function to clone this list (create a new copy of the same). Don't use extra space (just the pointer variables are fine).

Respostas da entrevista

Sigiloso

19 de set. de 2012

There is a singly linked list: A -> B -> C -> D -> E Each node has another variable called "random". It points to another node in the same list. For example, the "random" variable in the node "B", points to some other node in this list. Say, "E". Now the question is to clone this list. Got it?!

1

Sigiloso

17 de ago. de 2012

If any problem has the condition, "Don't use extra space", it in-directly means that, you can modify the list. Clarify it. It took some time for me to clarify that I'm allowed to modify the source list.

1

Sigiloso

18 de set. de 2012

didnt get the point can you please elaborate ???