## Conversion of a Linked List into Array

Conversion of a Linked List into Array The conversion process involves creation of a linked list.  Then the list is read from the first node till the last node such that each node value is stored in an array and the node is removed by freeing its memory.  The array is then displayed as an …

## Josephus Algorithm

Josephus Algorithm The problem is described as, “If there are n persons standing in a circle.  Beginning from any person, the others are numbered in a particular direction (clockwise or anti-clockwise).  Then a random number, n is generated.  The counting begins from the person numbered as one upto n.  The nth person is removed from …

## Polynomial – Representation, Addition, Multiplication

Polynomial Manipulation Representation Addition Multiplication Representation of a Polynomial:  A polynomial is an expression that contains more than two terms.  A term is made up of coefficient and exponent.  An example of polynomial is P(x) = 4×3+6×2+7x+9 A polynomial thus may be represented using arrays or linked lists.  Array representation assumes that the exponents of …

Circular Linked list Creation of a Circular Linked List: A circular linked list is similar to that of a singly linked list with the only difference that the last node points the first node of the list, such that a circular path is obtained.  Thus last node of this list instead of pointing to NULL …

## Program for operations on a Doubly Linked List

Doubly Linked List Program to create a doubly linked list with the possible operations that can be done is given below: /*Program to create a doubly linked list along with various operations that can be performed on it.*/ /*Doubly Linked List*/ #include #include #include typedef struct dlist { int info; struct dlist *prev; struct dlist …

Representation of a doubly linked list: A doubly linked list contains backward as well as forward reference.  Each node contains two address along with the information field.  One address is the address of the next node and the other one is that of the previous node.  Thus doubly linked list is a bi-directional list, since …

## Program for operations on a Singly Linked List

Singly Linked List Program for various operations that can be done on a Singly Linked List is given below: /*Program for Singly Linked List*/ /*Operations on Linked List*/ #include <stdio.h> #include <stdlib.h> #include <conio.h> typedef struct list {int n; struct list *next; }list; list *createnode() {list *temp; temp=(list*)malloc(sizeof(list)); return temp; } list *makenode(int x) {list …

## Program to create a Sorted Linked List

Singly Linked List – Creation Sorted Program to create a Sorted Linked List Creating a Sorted Linked List involves insertion of a new node in the linked list such that the order of the list is preserved.  The order to be retained in the list may be chosen as either ascending or descending order. /*Program …

## Program to create a FIFO Linked List

Singly Linked List – Creation FIFO Program to create a FIFO linked list If a linked list is created considering FIFO order, then insertions are done at one end, whereas deletions are performed at the other end.  Thus, the first node to be deleted is only that node which is inserted first in the linked …

## Program to create a LIFO Linked List

Singly Linked List – Creation LIFO Program to create a LIFO Linked List:  Creation of a linked list may be done in LIFO order.  If a linked list is created in LIFO order, then insertions as well as deletions are done at the same end i.e. the last node of the linked list is the …