Step 1: Understanding the Question:
The question asks to trace the state of a Double-Ended Queue (Deque) after executing a specific sequence of insertion and deletion operations. The sequence of incoming input elements is 10, 20, 30, 40, 50, 60, processed in order.
Step 2: Key Operational Principles of a Deque:
- A Deque (Double-Ended Queue) allows insertion and deletion of elements from both ends (Front and Rear).
- INSERTFRONT(): Adds an element to the left (beginning) of the queue.
- INSERTREAR(): Adds an element to the right (end) of the queue.
- DELETEFRONT(): Removes the leftmost element from the queue.
- DELETEREAR(): Removes the rightmost element from the queue.
Step 3: Detailed Step-by-Step Execution Trace:
- We begin with an empty Deque: []
- The incoming elements are: 10, then 20, then 30, then 40, then 50, then 60.
- 1. INSERTFRONT() $\rightarrow$ Inserts 10 at the front:
Deque state: [10]
- 2. INSERTREAR() $\rightarrow$ Inserts 20 at the rear:
Deque state: [10, 20]
- 3. INSERTFRONT() $\rightarrow$ Inserts 30 at the front:
Deque state: [30, 10, 20]
- 4. DELETEREAR() $\rightarrow$ Removes the rear element (20):
Deque state: [30, 10]
- 5. DELETEFRONT() $\rightarrow$ Removes the front element (30):
Deque state: [10]
- 6. INSERTFRONT() $\rightarrow$ Inserts 40 at the front:
Deque state: [40, 10]
- 7. INSERTREAR() $\rightarrow$ Inserts 50 at the rear:
Deque state: [40, 10, 50]
- 8. INSERTFRONT() $\rightarrow$ Inserts 60 at the front:
Deque state: [60, 40, 10, 50]
- The final sequence of elements in the Deque is: [60, 40, 10, 50].
- Now let us map these values to the corresponding variable labels:
- 60 is represented by D.
- 40 is represented by B.
- 10 is represented by A.
- 50 is represented by C.
- This translates to the sequence: D, B, A, C.
Step 4: Final Answer:
The final sequence of elements in the Deque is D, B, A, C.
Hence, option (A) is the correct choice.