# Lists

**TIP: **Algorithms on lists can also be dealt with pointers. Taking pointers with different speeds can sometimes help us solve problems in linked lists.

algorithm to find if a linked list is cyclic: The best way of doing it is to take two pointers. For every step taken by one pointer, move another pointer two steps. In this manner if there is no cycle in the linked list(i.e, if …

algorithm to find if two linked lists are intersected: Two different lists will be intersected when one node of a list points to the other list’s node. The below diagram depicts the intersection of lists…

algorithm to remove element from single linked list: In this algorithm we were not given with the head node but instead given with the node that is to be deleted…

print single linked list in reverse orderThis is frequently asked question as we would be having only forward reference but not the backward reference to traverse the single linked list (SLL) in backward direction. We can do it recursively or by using LIFO data structure…

algorithm to find middle element of linked list @ O(n/2) order: Since every node in a linked list has the reference to its next node, we can achieve this solution by taking two pointers. For every increment in one pointer, increment the second pointer twice, in this way by the time second pointer…

algorithm to find nth last element of a single linked list: We can do this in two ways. 1. Recursive Approach; 2. Iterative Approach…

## Recent Comments