0 0 votes To insert a node at the end of double linked list we need to modify two pointers right??But answer given is one pointer. can someone clarify? Programming in C linked-list programming-in-c + – cse23 1.1k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes Assume we have a pointer " LAST " which point to the last pointer and we know LAST --> next = NULL we create a new pointer called NEW and add it to end of LL so we hv to modify following pointers : LAST --> next = NEW NEW --> prev = LAST NEW --> next = NULL Anil Khatri answered Sep 9, 2016 Anil Khatri comment Share Follow See all 4 Comments 4 4 Comments reply cse23 commented Sep 10, 2016 reply Follow flag ur approach is correct but in made easy test series answer given is one only.. I think to insert at the end we are modifying only last->next = new which was null earlier rest all ,we are assigning not modifying. new->next=null and new->prev=last both are assignment instead of modification. 1 1 replyShare Anil Khatri commented Sep 10, 2016 reply Follow flag if it like , how many links are modified in only given LL , i mean if we dont consider NEW node links 0 0 replyShare cse23 commented Sep 10, 2016 reply Follow flag ya...because new node is not there in the list and we are just assiging the value to its data and link part then inserting it at the end so it is added not modified. if something is already there and we are changing then we are are modifying the pointer. So, only one pointer is modified which is last->link 1 1 replyShare vijaycs commented Sep 10, 2016 reply Follow flag I agree with @cse23 0 0 replyShare Please log in or register to add a comment.