retagged by
2,233 views
2 2 votes

The initial configuration of a queue is a, b, c, d (a is in the front). To get the configuration d ,c, b, a, we need minimum number of:

  1. $2$ deletions & $3$ additions
  2. $3$ deletions & $2$ additions
  3. $3$ deletions & $3$ additions
  4. $3$ deletions & $4$ additions

1 Answer

Best answer
1 1 vote
The elements of queue are meant to be reversed and we know queue follows FIFO(first in first out) so according to this rule...
abcd ..a will be deleted then b and then c...
d will be left in queue
then c will be added - dc
then b will be added -dcb
then a will be added - dcba
so total no. of deletions and insertions will be 3 and 3 respectively
selected by
Answer:
Position:
Show:

Related questions

2 2 votes
3 3 answers
1.6k
1.6k views
Bikram asked Nov 26, 2016
1,572 views
A circular linked list is used to represents a queue. A single variable L is used to access the queue. To which node should L point such that both the operation enqueue a...
2 2 votes
2 answers 2 answers
2.7k
2.7k views
Bikram asked Nov 26, 2016
2,651 views
Meena is working in an IT company as HR manager. She has a large list of potential candidates to be recruited which are all sorted by their names. But she found that due ...
2 2 votes
2 answers 2 answers
1.3k
1.3k views
Bikram asked Nov 26, 2016
1,334 views
Consider an array of elements $6 \ 4 \ 5 \ 3 \ 7 \ 1$. The contents of the array after three passes when we apply Bubble Sort on it is$3 \ 4 \ 1 \ 5 \ 6 \ 7$$3 \ 4 \ 5 \ ...
1 1 vote
0 0 answers
762
762 views
Bikram asked Nov 26, 2016
762 views
The following sequence of operation is performed on stack : push(1),push(2),pop,push(1),push(2),pop,pop,pop,push(2),pop.The sequence of popped out values are?2,1,2,2,12,1...