Add numbers given in the form of Linked List

Two numbers are given in the form of linked list (with each node storing one digit). Write an algorithm which will compute the sum of […]

Find Merge-Point of two Linked Lists

Given two linked lists that merge at some point as shown below: Last four nodes are common to both the lists. Given pointers to the […]

Search in a sorted multi-level linked list

Given a multi-level linked list as shown in this post. Write code to search in such a list.

Printed a sorted multi-level linked list

Given a linked list, where each node has a pointer to the head of its child list (in addition to the next pointer). The child […]

Traverse and print a linked list in forward and backward order

Given a linked list, write code to print the list in forward and backward order. Solution: This problem is discussed as an example in this […]

Rearrange the nodes of a linked list

Given a linked list, rearrange the node of the list as shown below: INPUT LIST: 1 -> 2 -> 3 -> 4 -> 5 -> […]

Merge alternate nodes of the two lists

We have already seen the code to merge two sorted linked list, such that the final list is also sorted. The logic and code can […]

Convert a Binary Tree to a Doubly Linked List

The structure of Node of a Binary Tree and Doubly linked list are same. struct Node { int data; Node* left; Node* right; }  Structure […]

Reversing a linked list iteratively using only 2 pointers

Given a linked list, write the non-recursive function to reverse the list. If Input list is 1 -> 2 -> 3 -> 4 -> 5 Then […]

Recursive function to add 5 to alternate nodes of the linked list

Write a recursive function that add 5 to the alternate nodes of the linked list. For example, if the list is 1 -> 2 -> […]