A deque contains ‘a’,’x’,’z’,’v’ and ‘b’ (from FRONT to REAR). Elements received after deletion are ‘b’,’a’,’v’,’x’ and ‘z’. Identify the sequence of deletion operation performed on deque.
A deque contains ‘a’,’x’,’z’,’v’ and ‘b’ (from FRONT to REAR). Elements received after deletion are ‘b’,’a’,’v’,’x’ and ‘z’. Identify the sequence of deletion operation performed on deque.
Solution
✅ Correct Option: 2
Each deletion must remove the element at the FRONT or the REAR of what is left, so we trace the removals in the order given.
| Deletion | Deque before | Element removed | Operation |
|---|---|---|---|
| 1 | a x z v b | b (rear) | DELETIONREAR |
| 2 | a x z v | a (front) | DELETIONFRONT |
| 3 | x z v | v (rear) | DELETIONREAR |
| 4 | x z | x (front) | DELETIONFRONT |
| 5 | z | z (only element) | DELETIONREAR |
The sequence is REAR, FRONT, REAR, FRONT, REAR.
The last element is both front and rear, so either operation removes it. Option 2 is the only choice whose first four operations match.
Related questions:
2026: 29 May Shift 1
2025: 22 May Shift 1
2025: 16 May Shift 1
2026: 24 May Shift 1
2026: 19 May Shift 1