##
Select a Random Node from a Singly Linked List
May 24, 2015

Given a singly linked list, select a random node from linked list (the probability of picking a node should be 1/N if there are N… Read More »

May 24, 2015

Given a singly linked list, select a random node from linked list (the probability of picking a node should be 1/N if there are N… Read More »

May 23, 2015

We have discussed Insertion Sort for arrays. In this article same for linked list is discussed. Below is simple insertion sort algorithm for linked list.… Read More »

May 2, 2015

Given a doubly linked list, write a function to sort the doubly linked list in increasing order using merge sort.

April 23, 2015

Given singly linked list with every node having an additional “arbitrary” pointer that currently points to NULL. Need to make the “arbitrary” pointer point to… Read More »

April 6, 2015

Given a linked list and two keys in it, swap nodes for two given keys. Nodes should be swapped by changing links. Swapping data of… Read More »

April 4, 2015

Unlike C++ and Java, C doesn’t support generics. How to create a linked list in C that can be used for any data type? In… Read More »

March 28, 2015

Write a C function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present… Read More »

Write a C function to count number of nodes in a given singly linked list. For example, the function should return 5 for linked list… Read More »

January 5, 2015

We have already discussed 2 different ways to clone a linked list. In this post, one more simple method to clone a linked list is… Read More »

December 8, 2014

Given a linked list of co-ordinates where adjacent points either form a vertical line or a horizontal line. Delete points from the linked list which… Read More »

November 28, 2014

Given two sorted linked lists, construct a linked list that contains maximum sum path from start to end. The result list may contain nodes from… Read More »

September 30, 2014

Given a singly linked list, delete all occurrences of a given key in it. For example, consider the following list.

July 26, 2014

It doesn’t look possible to reverse a simple singly linked list. A simple singly linked list can only be reversed in O(n) time using recursive… Read More »

July 4, 2014

In general, array is considered a data structure for which size is fixed at the compile time and array memory is allocated either from Data… Read More »

May 24, 2014

We have discussed Linked List Introduction and Linked List Insertion in previous posts on singly linked list.