For the 2nd ques, wat i think is the interviewer has kept the restriction of
not moving the data since you may have a linked list about which you donot
have much information about the structure of the node of the list(only know
about the next pointer) and hence you cannot move the data. For that, you
can free the middle node and copy the last node bit by bit at the location
of the middle node.

If you still dont want to use the method above, you will have to free the
middle node and reallocate the next node at the location of the middle node.
For this wat i could think was to use the realloc() and put it in a while
loop and terminate the loop only when the address returned matches with the
address possesed by the middle node. But this method is not efficient and
also unwise. If anyone can think of something better, he/she is invited

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to