Basic Problems on Linked Lists

In this section we will go through some of the basic programming problems involving linked lists.

Search for a value in Linked List

Linked lists are made up of a sequence of nodes where each node links to the next one, forming a chain-like structure. Searching for a value in a linked list involves visiting each node in the list in sequence, access its value and checking if it is equal to the desired value. Read More

Reverse a linked list (iterative and recursive approaches)

A linked list consists of nodes where each node contains an item/value along with a reference to next node in the sequence. Reversing a linked list involves changing the direction of the links for each node, effectively flipping the linked list from its original order to the opposite. Read More

Remove duplicates from a sorted linked list

Removing duplicate elements from a sorted linked list involves eliminating nodes with repeated occurrences of similar elements while maintaining the sorted order of the list. In order to remove duplicates, we traverse through the linked list one node at a time while checking is the next node’s value is same a current node. Read More

Merge two sorted linked lists into one sorted linked list

Merging two sorted linked lists involves combining all nodes present in each of the two input linked lists into a single linked list while maintaining their sorted order. To accomplish this, we need consume the smallest head node among both the linked lists and add it to the final list. Read More