# [Problems] Summary of Problems on Linked Lists with Approaches

Here we will see the approaches for the problems given @ http://javajee.com/problems-summary-of-problems-on-linked-lists-for-inte....

### Problems and Approaches

2. Remove duplicates from a sorted linked list.

3. Remove duplicates from an unsorted linked list.

4. Find the Kth to last element in a linked list

5. Delete a node in the middle of a singly linked list, given only access to that node.

6. Given a linked list with a loop (circular linked list), find the node at the beginning of the loop.

7. Partitian a linked list around a given value x, with all nodes with values less than x should come before all nodes with values greater than or equal to x.

8. Given two sorted (ascending) linked lists L1 and L2. Write a program to merge them into a single descending linked list.

• Example:

• List1 = 5>15>25>35>null.

• List2 = 1>10>20>30>null.

• ResultList = 35>30>25>20>15>10>5>1>null.

9. Find the middle element of linked list in one Pass?

• Approach: You can use the runner technique.  Two pointers can be used and both will be running at separate speeds. One runner pointer can go in two steps at a time and other pointer can go in one step at a time. Second one will always cover half the distance as that of the other. When one reaches the end, other will be be middle.