//posted by Mr. VINOD KUMAR HOODA from HISAR, HARYANA
#include<stdio.h>
#include<conio.h>
void insert(int);
int delet(int);
void display(void);
void run(void);
void checkf(int z);
void checke(void);
int size=5;
int rear=-1;
int front=-1;
int queue[5]={55,66,77};
void main()
{
front+=1;
rear+=3;
int n;
int op;
printf("current queue is:");
display();
printf("\nPress:");
printf("\n1: for insertion of an element into the queue");
printf("\n2: for deletion of an element from the queue");
printf("\n3: check for full queue");
printf("\n4: check for empty queue");
printf("\n5: for exit\n");
scanf("%d",&op);
switch(op)
{
case 1:insert(size);break;
case 2:delet(size);break;
case 3:checkf(size); break;
case 4:checke(); break;
case 5:exit(1); break;
default:printf("\nWrong operator");
}
getch();
}
void insert(int n)
{
int item;
if(front!=-1&&rear!=n)
{
printf("\nEnter the item to be inserted");
scanf("%d",&item);
queue[rear+1]=item;
}
else
{
printf("\ncan not be inserted\n");
}
display();
}
int delet(int n)
{
printf("\ndeleted from queue\n");
if(front!=-1 && front!=rear)
{ run();
display();
}
else if(front!=-1 && front==rear)
{ run();
front=front-1;
display();
}
else if(front==-1)
{ printf("\nQueue is empty"); }
}
void display(void)
{
int i;
printf("\nDisplaying Queue\n");
for(i=0;i<size;i++)
printf("%d ",queue[i]);
}
void run(void)
{ int m,temp;
for(m=front;m<=rear-1;m++)
{temp=queue[m];
queue[m]=queue[m+1];
}
for(m=rear;m<size;m++)
{ queue[m]=0; }
rear=rear-1;
}
void checkf(int z)
{ if(rear==z-1)
{ printf("Queue is Full \n");
}
else
{ printf("Queue is not Full, new values can be inserted. \n");
}
}
void checke(void)
{ if(front==-1)
{ printf("Queue is empty \n");
}
else
{ printf("Queue is not empty, new values can be deleted. \n");
}
}
Double ended Queue: double-ended queue (often abbreviated to deque, pronounced deck) is an abstract data structure that implements a queue for which elements can only be added to or removed from the front (head) or back (tail). It is also often called a head-tail linked list. There are at least two common ways to efficiently implement a deque: with a modified dynamic array or with a doubly-linked list. Dynamic array implementation uses a variant of a dynamic array that can grow from both ends, sometimes called array deques. These array deques have all the properties of a dynamic array, such as constant time random access, good locality of reference, and inefficient insertion/removal in the middle, with the addition of amortized constant time insertion/removal at both ends, instead of just one end. Three common implementations include:
"IMPLEMENTATION OF DEQUEUE USING ARRAY"
#include
#include
int q[5],front=-1,rear=-1,max=5;
void print()
{
int i;
if(front==-1)
printf("QUEUE EMPTY");
else
{
if(front<=rear)
for(i=front;i<=rear;i++)
printf(" %d ",q[i]);
else
{
for(i=0;i<=rear;i++)
printf(" %d ",q[i]);
for(i=front;i printf(" %d ",q[i]); } } } void insertrear() { if((front==rear+1)((front==0)&&(rear==max-1))) printf("QUEUE IS FULL"); else { if(rear==max-1) rear=0; else rear++; if(front==-1) front++; printf("ENTER THE ELEMENT TO BE INSERTED :"); scanf("%d",&q[rear]); printf("\ QUEUE AFTER INSERTION :"); print(); } } void delbeg() { if(front==-1) printf("QUEUE EMPTY"); else { printf("ELEMENT DELETED : %d",q[front]); if(front==rear) { front=-1; rear=-1; } else if(front==max-1) front=0; else front++; printf("\ QUEUE AFTER DELETION :"); print(); } } void insertbeg() { if((front==rear+1)((front==0)&&(rear==max-1))) printf("QUEUE IS FULL"); else { if(front==-1) { front++; rear++; } else if(front==0) front=max-1; else front--; printf("ENTER THE ELEMENT TO BE INSERTED :"); scanf("%d",&q[front]); printf("\ QUEUE AFTER INSERTION :"); print(); } } void delrear() { if(front==-1) printf("QUEUE EMPTY"); else { printf("ELEMENT DELETED : %d",q[rear]); if(front==rear) { front=-1; rear=-1; } else if(rear==0) rear=max-1; else rear--; printf("\ QUEUE AFTER DELETION :"); print(); } } void main() { int ch; clrscr(); do { printf("\n1) INSERTION AT FRONT \n2)INSERTION AT REAR\n3.DELETEION AT FRONT\n4.DELETION AT REAR\n "); printf("\n ENTER CHOICE "); scanf("%d",&ch); switch(ch) { case 1:insertbeg(); break; case 2:insertrear(); break; case 3:delbeg(); break; case 4:delrear(); break; default :printf("WRONG CHOICE"); break; } }while(ch>=1&&ch<=4); getch(); }
class person
{
public:
int arr_tym, trans_tym, wait_tym, deprt_tym;
};
class queue
{
private:
person data[5];
int front , back , count;
public:
queue()
{
front=0;
back=0;
count=0;
}
void Front()
{
cout<<" \n The arrival time of the first customer is :"< cout<<" \n And the transaction time of the first customer is :"< } void enqueue(int a_tym, int t_tym) { if(count==5) cout<<"\n The queue is full. \n"; else if(count<5) { data[back].arr_tym=a_tym; data[back].trans_tym=t_tym; count++; if(back==4) back=0; else if(back<4) back++; } Front(); } void dequeue() { if(count==0) cout<<"\n The queue is already empty. \n"; else if(count>0) { data[front].arr_tym=0; data[front].trans_tym=0; if(front<4) front+=1; else if(front==4) front=0; cout<<"\n The element has been deleted. \n"; count--; Front(); } } void Is_Empty() { if(count==0) cout<<"\n The queue is empty. \n"; else if(count<5&&count>0) cout<<"\n The queue has "< else if(count==5) cout<<"\n The queue is full. \n"; } void cal_w8_tym() { for(int i=front;i<5;i++) { if(i==1) { data[i].deprt_tym=data[i].arr_tym+data[i].trans_tym; data[i].wait_tym=0; } else { if(data[i].deprt_tym { data[i].deprt_tym=data[i].arr_tym+data[i].trans_tym; data[i].wait_tym=0; } else { data[i].deprt_tym=data[i-1].deprt_tym+data[i].trans_tym; data[i].wait_tym=data[i-1].deprt_tym-data[i].arr_tym; } } } } void display() { cout<<"\n\tARRIVAL TIME\tTRANSACTION TIME\tWAITING TIME\tDEPARTING TIME\n"; for(int i=front;i<5;i++) { cout<<"\n\t"< cout<<"\t"< cout<<"\t"< cout<<"\t"< } } void avg_w8_tym() { } }; void main() { queue q; int arr_time,trans_time; char opt; do { cout<<"\n Enter arrival time of the customer: "; cin>>arr_time; cout<<" \n Enter transaction time of the customer: "; cin>>trans_time; q.enqueue(arr_time,trans_time); cout<<"\n Do you want to continue? "; cin>>opt; }while(opt=='y'); q.Front(); q.dequeue(); q.Is_Empty(); q.dequeue(); q.cal_w8_tym(); q.display(); } LINKED LIST BASED CIRCULAR QUEUE #include class node { public: int data; node* link; }; class queue { node* front; node* back; public: queue() { front=NULL; back=NULL; } void enqueue(int d) { node* ptr; ptr=new node; ptr->data=d; ptr->link=NULL; if(front==NULL) { front=ptr; back=ptr; } else { back->link=ptr; back=back->link; } } void dequeue() { node* ptr; ptr=front; if(front==NULL) cout<<"\n Nothing can be deleted. \n"; else { ptr=front; front=front->link; delete ptr; ptr=NULL; cout<<"\n The first element has been deleted.\n"; Front(); } } void If_Empty() { if(front==NULL) cout<<"\n The queue is empty.\n "; } void Front() { if(front!=NULL) cout<<"\n The first element is "< } }; void main() { queue q; int data; char opt; do { cout<<" Enter your data:\t"; cin>>data; q.enqueue(data); cout<<"\n Do you want to continue:\t"; cin>>opt; }while(opt=='y'opt=='Y'); q.Front(); q.dequeue(); q.If_Empty(); q.dequeue(); q.dequeue(); q.If_Empty(); q.dequeue(); }
#include<iostream.h>
class node
{
public:
int data;
node* link;
};
class queue
{
node* front;
node* back;
public:
queue()
{
front=NULL;
back=NULL;
}
void enqueue(int d)
{
node* ptr;
ptr=new node;
ptr->data=d;
ptr->link=NULL;
if(front==NULL)
{
front=ptr;
back=ptr;
}
else
{
back->link=ptr;
back=back->link;
}
}
void dequeue()
{
node* ptr;
ptr=front;
if(front==NULL)
cout<<"\n Nothing can be deleted. \n";
else
{
ptr=front;
front=front->link;
delete ptr;
ptr=NULL;
cout<<"\n The first element has been deleted.\n";
Front();
}
}
void If_Empty()
{
if(front==NULL)
cout<<"\n The queue is empty.\n ";
}
void Front()
{
if(front!=NULL)
cout<<"\n The first element is "<<front->data<<endl;
}
};
void main()
{
queue q;
int data;
char opt;
do
{
cout<<" Enter your data:\t";
cin>>data;
q.enqueue(data);
cout<<"\n Do you want to continue:\t";
cin>>opt;
}while(opt=='y'opt=='Y');
q.Front();
q.dequeue();
q.If_Empty();
q.dequeue();
q.dequeue();
q.If_Empty();
q.dequeue();
}
#include <iostream> using namespace std; template <class T> struct Node { T data; Node * next; Node(T data) : data(data), next(NULL) {} }; template <class T> class CircularLinkedList { public: CircularLinkedList() : head(NULL) {} ~CircularLinkedList(); void addNode(T data); void deleteNode(T data); template <class U> friend std::ostream & operator<<(std::ostream & os, const CircularLinkedList<U> & cll); private: Node<T> * head; }; template <class T> CircularLinkedList<T>::~CircularLinkedList() { if (head) { Node<T> * tmp = head; while (tmp->next != head) { Node<T> * t = tmp; tmp = tmp->next; delete(t); } delete tmp; head = NULL; } } template <class T> void CircularLinkedList<T>::addNode(T data) { Node<T> * t = new Node<T>(data); if (head == NULL) { t->next = t; head = t; return; } Node<T> * tmp = head; while (tmp->next != head) { tmp = tmp->next; } tmp->next = t; t->next = head; } template <class T> void CircularLinkedList<T>::deleteNode(T data) { Node<T> * tmp = head; Node<T> * prev = NULL; while (tmp->next != head) { if (tmp->data == data) break; prev = tmp; tmp = tmp->next; } if (tmp == head) { while (tmp->next != head) { tmp = tmp->next; } tmp->next = head->next; delete head; head = tmp->next; } else { prev->next = tmp->next; delete tmp; } } template <class U> std::ostream & operator<<(std::ostream & os, const CircularLinkedList<U> & cll) { Node<U> * head = cll.head; if (head) { Node<U> * tmp = head; while (tmp->next != head) { os << tmp->data << " "; tmp = tmp->next; } os << tmp->data; } return os; } int main() { CircularLinkedList<int> cll; cll.addNode(1); cll.addNode(2); cll.addNode(3); cll.addNode(4); cll.addNode(5); cout << cll << endl; cll.deleteNode(3); cll.deleteNode(1); cll.deleteNode(5); cout << cll << endl; return 0; }
#include < stdio.h>
#include < conio.h>
#include < malloc.h>
#include < process.h>
#include < ctype.h>
#define SIZE 5
void menu();
void display();
int underflow();
int overflow();
void enqueue(int);
void dequeue();
int cqueue[SIZE];
int front=-1;
int rear=-1;
void main()
{
clrscr();
menu();
}
void menu()
{
int choice,item;
printf("MENU");
printf("\n1. Insert into the queue");
printf("\n2. Delete from queue");
printf("\n3. Display");
printf("\n4. Exit");
printf("\nEnter your choice: ");
scanf("%d",&choice);
switch(choice)
{
case 1:
clrscr();
if(overflow()==0)
{
printf("\nEnter the item tobe inserted: ");
scanf("%d",&item);
enqueue(item);
clrscr();
printf("\nAfter inserting queue is:\n");
}
display();
getch();
clrscr();
menu();
break;
case 2:
clrscr();
if(underflow()==1)
{
dequeue();
if(underflow()==1)
{
printf("\nAfter deletion queue is:\n");
display();
}
}
getch();
clrscr();
menu();
break;
case 3:
clrscr();
if(underflow()==1)
{
printf("The queue is:\n");
display();
}
getch();
clrscr();
menu();
break;
case 4:
exit(1);
default:
clrscr();
printf("Your choice is wrong\n\n");
menu();
}
}
int underflow()
{
if((front==-1)&&(rear==-1))
{
printf("\nQueue is empty");
return(0);
}
else
{
return(1);
}
}
int overflow()
{
if(((front==0)&&(rear==SIZE-1))(front==rear+1))
{
printf("\nQueue is full\n");
return(1);
}
else
{
return(0);
}
}
void enqueue(int item)
{
if((front==-1)&&(rear==-1))
{
front=0;
rear=0;
}
else if(rear==SIZE-1)
{
rear=0;
}
else
{
rear=rear+1;
}
cqueue[rear]=item;
}
void dequeue()
{
if(front==rear)
{
front=-1;
rear=-1;
}
else if(front==SIZE-1)
{
front=0;
}
else
{
front=front+1;
}
}
void display()
{
int i;
if(front<=rear)
{
for(i=front;i<=rear;i++)
{
printf("\nElement %d : %d",i+1,cqueue[i]);
}
}
else
{
for(i=front;i<=SIZE-1;i++)
{
printf("\nElement %d : %d",i+1,cqueue[i]);
}
for(i=0;i<=rear;i++)
{
printf("\nElement %d : %d",i+1,cqueue[i]);
}
}
}
Linear Queue C Program using structure
#include
#include
#include
#define MAX 50
typedef enum{true,false} bool;
typedef struct{
int front,rear;
int elements[MAX];
}queue;
bool isfull(queue *);
bool isempty(queue *);
void create(queue *);
void enqueue(queue *,int);
void dequeue(queue *);
void peek(queue *);
void trav(queue *);
void main()
{
int choice,element;
queue *pq, q;
//printf("hello22");
create(&q);//printf("hello11");
clrscr();
while(1){
printf("\n1-enqueue\n2-dequeue\n3-peek\n4-traverse\n5-exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1: clrscr();
if(isfull(&q)) { printf("queue full");
getch();
}
else{ printf("enter the value");
scanf("%d",&element);
enqueue(&q,element);
}
break;
case 2: clrscr();
if(isempty(&q)) { printf("queue empty\nenter any key to continue");
getch();
}
else { dequeue(&q);
printf("\npress any key to continue");
getch();
}
break;
case 3:clrscr();
if(isempty(&q)) { printf("stack empty\nenter any key to continue");
getch();
}
else { peek(&q);
printf("\npress any key to continue");
getch();
}
break;
case 4:trav(&q);
printf("\npress any key to continue");
getch();
break;
case 5:exit(1);
}
}
getch();
}
void create(queue *pq)
{
pq->front=pq->rear=-1;
}
bool isfull(queue *pq)
{
if((pq->front==0)&&(pq->rear==MAX-1)) {//printf("heewuey%d",ps->top);
return 1; }
else {//printf("wreryteud%d",ps->top);
return 0;}
}
bool isempty(queue *pq)
{
if(pq->front==-1) return 1;
else return 0;
}
void enqueue(queue *pq,int element)
{int i;
if(pq->front==-1) pq->front=pq->rear=0;
else if (pq->rear==MAX-1)
{
for(i=pq->front;i<=pq->rear;i++)
pq->elements[i-pq->front]=pq->elements[i];
pq->rear=pq->rear+pq->front-1;
pq->front=0;
}
else pq->rear++;
pq->elements[pq->rear]=element;
}
void dequeue(queue *pq)
{
int temp;
temp=pq->elements[pq->front];
if(pq->front==pq->rear) pq->front=pq->rear=-1;
else pq->front++;
printf("deleted val is %d",temp);
}
void peek(queue *pq)
{
printf("front element is %d",pq->elements[pq->front]);
}
void trav(queue *pq)
{
int i;
for(i=pq->front;i<=pq->rear;i++)
printf("%d\t",pq->elements[i]);
}
Circular Queue C program
#include
#include
#include
#define MAX 50
typedef enum{true,false} bool;
typedef struct{
int front,rear;
int elements[MAX];
}queue;
bool isfull(queue *);
bool isempty(queue *);
void create(queue *);
void enqueue(queue *,int);
void dequeue(queue *);
void peek(queue *);
void trav(queue *);
void main()
{
int choice,element;
queue *pq, q;
//printf("hello22");
create(&q);
clrscr();
while(1){
printf("\n1-enqueue\n2-dequeue\n3-peek\n4-traverse\n5-exit\n");
scanf("%d",&choice);
switch(choice)
{
case 1: clrscr();
if(isfull(&q)) { printf("queue full");
getch();
}
else{ printf("enter the value");
scanf("%d",&element);
enqueue(&q,element);
}
break;
case 2: clrscr();
if(isempty(&q)) { printf("queue empty\nenter any key to continue");
getch();
}
else { dequeue(&q);
printf("\npress any key to continue");
getch();
}
break;
case 3:clrscr();
if(isempty(&q)) { printf("stack empty\nenter any key to continue");
getch();
}
else { peek(&q);
printf("\npress any key to continue");
getch();
}
break;
case 4:trav(&q);
printf("\npress any key to continue");
getch();
break;
case 5:exit(1);
}
}
getch();
}
void create(queue *pq)
{
pq->front=pq->rear=-1;
}
bool isfull(queue *pq)
{
if((pq->front==0)&&(pq->rear==MAX-1)) {
return 1; }
else {
return 0;}
}
bool isempty(queue *pq)
{
if(pq->front==-1) return 1;
else return 0;
}
void enqueue(queue *pq,int element)
{int i;
if(pq->front==-1) pq->front=pq->rear=0;
else if (pq->rear==MAX-1) pq->rear=0;
else pq->rear++;
pq->elements[pq->rear]=element;
}
void dequeue(queue *pq)
{
int temp;
temp=pq->elements[pq->front];
if(pq->front==pq->rear) pq->front=pq->rear=-1;
else if(pq->front==MAX-1) pq->front=0;
else pq->front++;
printf("deleted val is %d",temp);
}
void peek(queue *pq)
{
printf("front element is %d",pq->elements[pq->front]);
}
void trav(queue *pq)
{
int i;
for(i=pq->front;i<=pq->rear;i++)
printf("%d\t",pq->elements[i]);
}
In order to work with an array you need to know several pieces of information about that array: the array's type, the start address of the array, the number of used elements in the array and the number of unused elements in the array. Note that unused elements must always be at the end of the array, you cannot leave gaps within the used elements.
The first two pieces of information can be obtained from the array itself, but the last two need to be stored in separate variables. To simplify things, it's best to store this information in a data structure. For example, the following structure is suitable for a one-dimensional array of type int:
typedef struct int_array_t {
int* ptr;
unsigned size;
unsigned reserve;
} int_array;
The size member determines the number of elements currently used by the array pointed to by the ptr member. The reserve member determines the number of unused elements at the end of the array. The total size of the array can be obtained from the sum of these two members.
When inserting an element into an array you first check the reserve. If it is zero, you need to reallocate the array. The simplest way to do so is to double the size of the array, although increasing by 160% is considered more efficient. The following function takes care of that:
/* increase array capacity by 160% */
int reallocate_int_array (int_array* p) {
if (!p !p->ptr) return ERROR_FAILURE;
if (p->reserve) return ERROR_SUCCESS;
int* pointer;
unsigned capacity;
capacity = p->size * 1.6;
pointer = realloc (p->ptr, capacity * sizeof (int));
if (!pointer) return ERROR_FAILURE;
p->ptr = pointer;
p->reserve = capacity - p->size;
return ERROR_SUCCESS;
}
Note that the function uses rudimentary error values. You may wish to expand upon this to provide more meaningful error messages.
You should also provide a corresponding shrink_to_fit function to remove the reserve when it is no longer required:
void shrink_to_fit (int_array* p) {
if (!p !p->ptr) return ERROR_FAILURE;
if (!p->reserve) return ERROR_SUCCESS;
p->ptr = realloc (p->ptr, p->size * sizeof (int));
p->reserve = 0;
return ERROR_SUCCESS;
}
With these in place we can now write functions to insert and extract values. The simplest way to insert a new value is to push it to the back of the array where the unused elements reside:
int push_back_int_array (int_array* p, int value) { if (!p !p->ptr) return ERROR_FAILURE;
if (!reserve) {
int error;
error = reallocate_int_array (p);
if (error) return error;
}
p->ptr[p->size++] = value;
--p->reserve;
return ERROR_SUCCESS;
}
The simplest way to extract elements is to pop the last element from the array:
int pop_back_int_array (int_array* p) {
if (!p !p->ptr !p->size) return ERROR_FAILURE;
--p->size;
++p->reserve;
return ERROR_SUCCESS;
}
In order to insert elsewhere in the array, you need to create a gap at the insertion point by moving all elements from the insertion point one place to the right:
int insert_int_array (int_array* p, int value, unsigned index) {
if (!p !p->ptr) return ERROR_FAILURE;
if (index>=p->size) return push_back (p, value);
if (!p->reserve) {
int error;
error = reallocate_int_array (p);
if (!error) return error;
}
unsigned i;
for (i=size; i!=index; --i) p->ptr[i] = p->ptr[i-1];
p->ptr[index] = value;
return ERROR_SUCCESS;
}
Similarly, to extract elsewhere in the array, you need to remove the gap created by that extraction:
int extract_int_array (int_array* p, unsigned index) {
if (!p !p->ptr !p->size) return ERROR_FAILURE;
if (index>=p->size) return ERROR_FAILURE;
unsigned i;
for (i=index; i!=size; ++i) p->ptr[i] = p->ptr[i+1];
--p->size;
++p->reserve;
return ERROR_SUCCESS;
}
Note that these functions only work with one-dimensional integer arrays. Each unique type of array requires its own unique data structure and its own set of functions.
write a c program for implementing queue ?
The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. Advantage of this type of queue is that empty location let due to deletion of elements using front pointer can again be filled using rear pointer.
A double ended queue, or deque, is a queue in which you can access or modify both the head and the tail. The front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)
In queue insertion takes place on rear end and deletion takes place on front end. INSERTION(QUEUE,N,FRONT,REAR,ITEM) :QUEUE is the name of a array on which we are implementing the queue having size N. view comlete ans at http://mcabcanotes.in/algorithm-to-perform-insertion-and-deletion-in-a-queue/
A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion). So when we need to insert or delete at both end we need deque.
A queue is simply a FIFO i.e first in first out. In queue we've front and rear. Front is the initial or first location of the queue whereas rear indicates the last entry location in the queue. In the circular queue the location of front and rear will be the same IF the total space of the circular queue is utilized. Each element has its position no. for insertion , if we set the 5th element as the front element then after every insertion the ptr indicates the 5th element as front. in deletion, the fifth element is deleted every time it is the rear position. after deletion of an element the queue rotates and every time the rear indicates the 5th element of the circular queue. and every time the 5th location element is deleted.
The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. Advantage of this type of queue is that empty location let due to deletion of elements using front pointer can again be filled using rear pointer. A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)
The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. A circular queue is similar to the normal queue with the difference that queue is circular queue ; that is pointer rear can point to beginning of the queue when it reaches at the end of the queue. Advantage of this type of queue is that empty location let due to deletion of elements using front pointer can again be filled using rear pointer.
Data structures could be used to implement an efficient database. Linked lists for example will optimize insertion and deletion for ordered lists.
This has to do with computer programing. You may want to talk with someone who has the knowledge to get the right program.
Data structures could be used to implement an efficient database. Linked lists for example will optimize insertion and deletion for ordered lists.
frameshift- deletion and insertion point mutation- sustitution
Deletion is nothing but eliminating and insertion is adding.
A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)
The three different types of mutation are substitution, insertion, and deletion. They differ because deletion is missing a base, insertion has a base that was added, and substitution has a base that has been replaced.
A double ended queue, or deque, is a queue in which you can access or modify both the head and the tail. The front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion)
In queue insertion takes place on rear end and deletion takes place on front end. INSERTION(QUEUE,N,FRONT,REAR,ITEM) :QUEUE is the name of a array on which we are implementing the queue having size N. view comlete ans at http://mcabcanotes.in/algorithm-to-perform-insertion-and-deletion-in-a-queue/
A double ended queue (or deque ) is a queue where insertion and deletion can be performed at both end that is front pointer can be used for insertion (apart from its usual operation i.e. deletion) and rear pointer can be used for deletion (apart from its usual operation i.e. insertion). So when we need to insert or delete at both end we need deque.