264 views

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

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