Re: [algogeeks] Amazon Interview Question about Linked Lists

2010-12-21 Thread Nikhil Agarwal
@Saurabh You used an extra pointer compared to shiva's code ,you can avoid that. :) On Mon, Dec 20, 2010 at 8:24 PM, Saurabh Koar saurabhkoar...@gmail.comwrote: @Rishi:I think Shiva's code is also fine.U can access the list easily by using down pointer in his code. Because he is assigning

Re: [algogeeks] Amazon Interview Question about Linked Lists

2010-12-21 Thread Saurabh Koar
@Nikhil: ya..rt -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit

Re: [algogeeks] Amazon Interview Question about Linked Lists

2010-12-20 Thread Rishi Agrawal
See inline .. On Sat, Dec 18, 2010 at 12:09 PM, siva viknesh sivavikne...@gmail.comwrote: Given a linked list structure where every node represents a linked list and contains two pointers of its type: (i) pointer to next node in the main list. (ii) pointer to a linked list where

Re: [algogeeks] Amazon Interview Question about Linked Lists

2010-12-20 Thread Saurabh Koar
temp=head; temp1=temp-fwd; while(temp-fwd!=NULL) { temp2=temp; while(temp2-down!=NULL) temp2=temp2-link; temp2-down=temp1; temp-fwd=NULL; temp=temp1; temp1=temp1-fwd; } U can print the linked list using down pointer.Hope this will work.Correct me if I m wrong. -- You

Re: [algogeeks] Amazon Interview Question about Linked Lists

2010-12-20 Thread Saurabh Koar
@Rishi:I think Shiva's code is also fine.U can access the list easily by using down pointer in his code. Because he is assigning temp-down=temp2 and then he is making temp-fwd=NULL. On 12/20/10, Saurabh Koar saurabhkoar...@gmail.com wrote: temp=head; temp1=temp-fwd; while(temp-fwd!=NULL) {

Re: [algogeeks] Amazon Interview Question about Linked Lists

2010-12-20 Thread Saurabh Koar
@Rishi:I think Shiva's code is also fine.U can access the list easily by using down pointer in his code. Because he is assigning temp-down=temp2 and then he is making temp-fwd=NULL. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to

[algogeeks] Amazon Interview Question about Linked Lists

2010-12-18 Thread siva viknesh
Given a linked list structure where every node represents a linked list and contains two pointers of its type: (i) pointer to next node in the main list. (ii) pointer to a linked list where this node is head. Write a C function to flatten the list into a single linked list. Eg. If the given