GATE DA 2024 · Queues

NAT · 1 mark · Problem PROG-DSTR-0058

The fundamental operations in a double-ended queue D are:insertFirst(e) - Insert a new element \(e\) at the beginning of \(D\). insertLast(e) - Insert a new element \(e\) at the end of D . removeFirst()-Remove and return the first element of D. removeLast () - Remove and return the last element of D.In an empty double-ended queue, the following operations are performed:
insertFirst (10)
insertLast (32)
\(a \leftarrow\) removeFirst ()
insertLast (28)
insertLast(17)
\(a \leftarrow\) removeFirst () \({a} \leftarrow\) removeLast () The value of \({a}\) is .

Numerical answer (NAT).

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: [17.0, 17.0].See full step-by-step discussion on GateOverflow: https://gateoverflow.in/422940/gate-ds%26ai-2024-question-22

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com