## 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 output. /*Conversion of a linked list into array*/ #include <stdio.h> #include <stdlib.h> #include <conio.h> #define…

Read more...Tags:Arrays , Data Structure , Linked List

## Josephus Algorithm

are closed

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 the game so that total number of persons in the circle gets reduced by one. …

Read more...## Polynomial – Representation, Addition, Multiplication

are closed

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 the given expression are arranged from 0 to the highest value (degree), which is represented…

Read more...Tags:Data Structure , Linked List , Polynomial

## Circular Linked List

are closed

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 points to the head node as described in the following figure:- Program to implement a…

Read more...## Program for operations on a Doubly Linked List

are closed

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 *next; }dlist; /*creation*/ dlist *create(); dlist *makenode(int); /*Insert a node at the end*/ dlist *insertend(dlist…

Read more...## Doubly Linked List

are closed

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 we may traverse either from left to right or from right to left directly without…

Read more...## Program for operations on a Singly Linked List

are closed

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 *temp; temp=createnode(); temp->n=x; temp->next=NULL; return temp; } /*11 13 15 17*/ /*Sorted search on a…

Read more...## Program to create a Sorted Linked List

are closed

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 for linked list creation,insertion and deletion.*/ /*Creation of Sorted Linked List*/ #include <stdio.h> #include <stdlib.h>…

Read more...## Program to create a FIFO Linked List

are closed

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 list. /*Program for linked list creation,insertion and deletion.*/ /*FIFO Linked List*/ #include <stdio.h> #include <stdlib.h>…

Read more...## Program to create a LIFO Linked List

are closed

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 first one to be deleted. /*Program for linked list creation,insertion and deletion.*/ /*LIFO Linked List*/…

Read more...
are closed