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 merged list. In the process Original lists should be deleted (the pointer to head of original lists should be set to NULL)
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 the loop.
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 below: bool search(Node*head, int x); head points to the first Node in the list. The function should return true is x is present in the list as false.
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 is The It should split into two lists like below To make the final output look like (breaking the original list in two sublists)
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 list. If the list given is 2 -> 3 -> 5 -> 1 -> 4 -> 8 -> 10 Then the function should return a pointer to Node with value 1. […]
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 Linked list is 2 -> 4 -> 6 -> 3 -> 7 and k=2, then output should be 3 (2nd node from end).