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…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


Mostly technology with occasional sprinkling of other random thoughts


Amir Amintabar's personal page

101 Books

Reading my way through Time Magazine's 100 Greatest Novels since 1923 (plus Ulysses)

Seek, Plunnge and more...

My words, my world...

ARRM Foundation

Do not wait for leaders; do it alone, person to person - Mother Teresa

Executive Management

An unexamined life is not worth living – Socrates


A topnotch site


Just another site

coding algorithms

"An approximate answer to the right problem is worth a good deal more than an exact answer to an approximate problem." -- John Tukey