8,266 views
1 1 vote

 The initial configuration of queue is a, b, c, d. ‘a’ is at the front. To get the configuration d, c, b, a how many deletions and additions required:

(A) 2 deletions, 3 additions   

(B) 3 deletions, 2 additions

(C) 3 deletions, 4 additions   

(D) 3 deletions, 3 additions

1 Answer

1 1 vote

@akankshadewangan24 here answer should be option D. But I would like to say  here that if the queue is implemented using single linked list or in any data structure for that matter, then one could have swapped the FRONT and REAR pointer which would give the desired output. In that case, no addition or deletion is required :D

Position:
Show:

Related questions

2 2 votes
2 2 answers
2.4k
2.4k views
Gurdeep Saini asked Jan 2, 2019
2,447 views
true/false ?) if stack is implemented as a array,all operation push ,pop ,is emptystack(),delete stack() can be performed in constant time.)if stack is implemented as a l...
1 1 vote
0 0 answers
2.8k
2.8k views
Na462 asked May 5, 2018
2,779 views
In implementation of queue using stack, deletion of second element from front take Ο(n) time, when insertion take Ο(1) time.Is it a true statement ?Well it can be true is...
1 1 vote
1 1 answer
1.7k
1.7k views
Ravi prakash pandey asked Apr 7, 2018
1,668 views
Hi please verify meWe can implement a stack using only one queue.Like first insert into queue and for popping a element from stack dequeue n-1 element from queue and enqu...
0 0 votes
1 1 answer
1.3k
1.3k views
Shivi rao asked Dec 12, 2017
1,288 views
Consider the following statements:S1 : Implementation of stack using queue, deletion of second element from top of stack time complexity Ο(n), when insertion take Ο(1) ti...