[algogeeks] Re: Amazon Interview Q

2011-08-18 Thread Vijay Kansal
We should return curr-next in the last statement of ur code On Aug 18, 7:08 am, Dipankar Patro dip10c...@gmail.com wrote: A slight change in above code: make it while(cur cur-next) ^^ other wise the code will crash at last element in a prefect list, with no loop. On 18 August 2011 07:36,

Re: [algogeeks] Re: Amazon Interview Q

2011-08-18 Thread Dipankar Patro
we can do that too. But if I return cur then I can myself print cur, cur-next, cur-next-prev. for verification. On 18 August 2011 11:56, Vijay Kansal vijaykans...@gmail.com wrote: We should return curr-next in the last statement of ur code On Aug 18, 7:08 am, Dipankar Patro

[algogeeks] Re: Amazon Interview Q

2011-08-18 Thread WgpShashank
Hi Piyuesh Same Question i Faced Some Times Ago, Have a look at algo/code let me know if any test case missed ? http://shashank7s.blogspot.com/2011/05/wap-to-detect-loop-in-doubly-linked.html if we wants to remove loop from DLL, we can do in the same way we used to do for singly linked