The following are problems with singly linked lists: A singly linked list allows traversal of the list in only one direction. Deleting a node from a list requires keeping track of the previous node,...

## Reversing the direction of links in a singly linked circular list

You can reverse the direction of links in the circular list. If you do so, each link should be reversed. To reverse the links of a singly linked circular list, the list is required...

## Merging of Two Circular Lists

You can merge two lists into one list. The following program merges two circular lists. In order to merge or concatenate the two non-empty circular lists pointed to by p and q, it is...

## Splitting a list with 2n nodes into two separate and equal lists

If the circular linked list has 10 nodes, then the two lists have 5 nodes each. The procedure for splitting a circular list with 2n nodes into two equal circular lists is given here:...

A circular list is a list in which the link field of the last node is made to point to the start/first node of the list, as shown in following Figure. In the case...

## Representation of Sparse Matrices

A matrix is a two-dimensional data object made of m rows and n columns, therefore having m ´ n values. When m=n, we call it a square matrix.   The most natural representation is...

## Polynomial Representation

One of the problems that a linked list can deal with is manipulation of symbolic polynomials. By symbolic, we mean that a polynomial is viewed as a list of coefficients and exponents. For example,...

Erasing a linked list involves traversing the list starting from the first node, freeing the storage allocated to the nodes, and then setting the pointer to the list to NULL. If p is a...

## Counting nodes of a Linked List

Counting the number of nodes of a singly linked list requires maintaining a counter that is initialized to 0 and incremented by 1 each time a node is encountered in the process of traversing...

## Inserting a new node in a sorted List

To insert a new node into an already sorted list, we compare the data value of the node to be inserted with the data values of the nodes in the list starting from the...

## Inserting a node after the specified node in a singly linked list

To insert a new node after the specified node, first we get the number of the node in an existing list after which the new node is to be inserted. This is based on...

## Deleting the nodes in a singly linked list

To delete a node, first we determine the node number to be deleted (this is based on the assumption that the nodes of the list are numbered serially from 1 to n). The list...

## Sorting and reversing a linked list

To sort a linked list, first we traverse the list searching for the node with a minimum data value. Then we remove that node and append it to another list which is initially empty....

## Inserting a node by using recursive programs

A linked list is a recursive data structure. A recursive data structure is a data structure that has the same form regardless of the size of the data. You can easily write recursive programs...