answersLogoWhite

0

Is it possible to delete the element randomly in queue?

Updated: 8/20/2019
User Avatar

Wiki User

11y ago

Best Answer

No,it's not possible to delete the element randomly

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is it possible to delete the element randomly in queue?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Difference between simple queue and circular queue?

Simple queue is a linear queue having front & rear var to insert & delete elements from the list.But there is a boundary that we have to insert at rear & have delete from front.For this reason instead of having space in the queue if there is a single element in the rear,the queue is full.the other space is wasted.To utilize space properly,circular queue is derived.In this queue the elements are inserted in circular manner.So that no space is wasted at all.


What is the difference between a priority queue and a circular queue?

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. A priority queue is a queue in which each element is inserted or deleted on the basis of their priority. A higher priority element is added first before any lower priority element. If in case priority of two element is same then they are added to the queue on FCFS basis (first come first serve).


Algorithm to insert and delete an element from a circular queue?

The Method To Add an element in Circular Queue # define MAXQUEUE 100 struct queue{ int items[MAXQUEUE]; int front, rear; } struct queue q; q.front=q.rear=MAXQUEUE -1; void ENQ(struct queue *pq, int x) { /* make room for new element*/ if(pq ->rear = MAXQUEUE - 1) pq-> rear = 0; else (pq->rear)++; /* check for overflow */ if(pq ->rear==pq->front) { printf("queue overflow); exit(1); } pq->items[pq->rear]=x; return; }/* end of ENQ*/ A Method to Delete an element from Circular Queue int DQ(struct queue *pq) { if(pq-> rear == pq-> front) { printf("queue underflow"); exit(1); }/*end if*/ if(pq->front = = MAXQUEUE-1) pq->front=0; else (pq->front)++; return(pq->items[pq->front]);


What is definition of circular queue?

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.


Implement a queue using a singly linked list l the operations insert and delete should still take o1time?

Suppose we have a Queue as follows: E -> D -> C -> B We maintain a head pointer to E and a tail pointer to B. To add an element, we make a new queue item (say A), we set B->next = A, and set tail = A. To delete an element, we let a temp pointer to the head (say tempHead = head), set head = E->next and deallocate tempHead.


What is the definition of circular queue?

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.


Algorithm to delete elements at both ends in a dequeue?

Delete Front---- DQDELETE_FRONT(QUEUE, FRONT, REAR, ITEM) 1. [check for queue underflow] If FRONT<0, Then: Print: "Queue is empty", and Return. 2. ITEM = QUEUE[FRONT]; 3. Set FRONT = FRONT + 1. 4. Return. Delete Rear---- DQDELETE_REAR(QUEUE, REAR, FRONT, ITEM) 1. [check for queue underflow] If REAR<0, Then: Print: "Queue is empty", and Return. 2. ITEM = QUEUE[REAR]. 3. Set REAR = REAR - 1. 4.Return.


Difference between circular queue and linear queue?

In circular queue the memory of the deleted process can be used by some other new process..


In a queue if rear equals front then what will be the queue?

if the queue contains one element then front end is equal to the rear end.


Difference between a queue and a stack in brief?

In a queue, elements are placed in line; the first to get into the queue is the first to get out (FIFO - first in, first out).A stack is also a structure to store pieces of data, or objects, but the last element to get in will be the first element to get out (LIFO).In a queue, elements are placed in line; the first to get into the queue is the first to get out (FIFO - first in, first out).A stack is also a structure to store pieces of data, or objects, but the last element to get in will be the first element to get out (LIFO).In a queue, elements are placed in line; the first to get into the queue is the first to get out (FIFO - first in, first out).A stack is also a structure to store pieces of data, or objects, but the last element to get in will be the first element to get out (LIFO).In a queue, elements are placed in line; the first to get into the queue is the first to get out (FIFO - first in, first out).A stack is also a structure to store pieces of data, or objects, but the last element to get in will be the first element to get out (LIFO).


Is cursor implementation possible in queue or stack?

yes,cursor implementation possible in priority queue.


How do i delete my queue from YouTube?

idk now how to delete ur queue from youtube but i had it and i wanted off and then all of asudden it was gone ok i typed this yesturday and i did it again im so stupid