Remove duplicates from a linked list

Given a linked list, write code to remove duplicates from the list. Input : 1->3->4->4->6->6->6->7 Output: 1->3->4->6->7 Input : 4->1->4->4 Output: 4->1

Merging two Linked List

Given two linked list with Node values sorted in ascending order. Write function that accepts these two linked lists, merge them and return pointer to […]

Detecting loop in a linked list

Given a Singly linked list which may contain a loop (link of last node pointing to some Node in the list). Write code to detect […]

Searching in a linked list

Given a singly linked list, write a function which will search for a value in the list. Signature of the function will be as shown […]

How to delete a node in a linked list if only pointer to node is given?

Given a pointer to Node in a Singly linked list. Is it possible to delete the same node ?

Splitting a linked list

Given a linked list, write code to split it into two lists each containing the  alternate (odd-even) nodes from the original. If the original list […]

Finding middle element of Linked list using one loop

Write a function which will accept a pointer to the head of the linked list and returns a pointer to the middle node of the […]

Recursive function to traverse linked list in reverse order

Write a recursive function to print the Linked list in reverse order …

Memory Efficient doubly linked list

Implement doubly linked list which has only one pointer (may not be directly of apointer data type) per node.

k'th Node from End

Given a linked list and a positive integer k, write a function which will return value of k’th node from the end of list. If […]