May 8, 2014 - C/C++, Programming    No Comments

Merging a linked list to another at alternate positions

The problem is to merge a given linked to list to another list at the alternative positions without using extra space.The problem can be understood by the example as
1->2->3->4->5 and 8->9->10 result into 1->8->2->9->3->10->4->5.
If no positions are left in the first list then we don’t merge the second list and the second list is left with some elements.
Example:
1->2->3 and 4->5->6->7->8 will merge to 1->4->2->5->3->6 and the second list will have 7->8.
Continue reading “Merging a linked list to another at alternate positions” »

Pages:1234»
UA-33384550-1