1.

How Do You Find The Sum Of Two Linked List Using Stack In Java?

Answer»

This is a relatively difficult LINKED questions when you COMPARE this to reversing a linked LIST or adding/removing elements from the linked list. In order to calculate the sum of linked list, you calculate the sum of values held at nodes in the same position, for example, you add values at first node on both the linked list to find the first node of resultant linked list. If the length of both linked list is not same then you only add elements from shorter linked list and just COPY values for REMAINING nodes from the long list.

This is a relatively difficult linked questions when you compare this to reversing a linked list or adding/removing elements from the linked list. In order to calculate the sum of linked list, you calculate the sum of values held at nodes in the same position, for example, you add values at first node on both the linked list to find the first node of resultant linked list. If the length of both linked list is not same then you only add elements from shorter linked list and just copy values for remaining nodes from the long list.



Discussion

No Comment Found