COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
A queue cannot be implemented using this stack.
|
|
A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions.
|
|
A queue can be implemented where ENQUEUE takes a sequence of three instruction and DEQUEUE takes a single instruction.
|
|
A queue can be implemented where both ENQUEUE and DEQUEUE takes a single instruction each
|
Detailed explanation-1: -Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack? A queue cannot be implemented using this stack.
Detailed explanation-2: -(D) A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each. Explanation: To DEQUEUE an item, simply POP.
Detailed explanation-3: -A priority queue is used to implement a stack that stores characters. Push(C) is used to implement Insert(Q, C, K) where K is the appropriate key chosen by the implementation.
Detailed explanation-4: -Expert-Verified Answer. Answer: yes, it is possible to implement multiple stacks in a Queue.