Question 21
What is the equivalent Prefix expression for the Infix expression (A + B) * (C - D)?
Prefix conversion: (A + B) becomes + A B, (C - D) becomes - C D. Multiplying gives * + A B - C D.
What is the equivalent Prefix expression for the Infix expression (A + B) * (C - D)?
Prefix conversion: (A + B) becomes + A B, (C - D) becomes - C D. Multiplying gives * + A B - C D.
What is the state of a Circular Queue of size N when the condition (rear + 1) % $N == front holds true$?
In a circular queue implementation using an array of size N, leaving one empty cell distinguishes Full condition ((rear + 1) % $N == front$) from Empty condition (front == -1 or front == rear).
Evaluating the Postfix expression '6 2 3 + * 4 -' yields what final numerical result?
Push 6, 2, 3. Operator '+': pop 3 and 2 -> 2+3=5, push 5. Operator '*': pop 5 and 6 -> 6*5=30, push 30. Push 4. Operator '-': pop 4 and 30 -> 30-4=26.
Which of the following statements about a Deque are correct?
A deque permits insertion and deletion at both front and rear. Using one end for both operations gives stack behavior, while using opposite ends gives queue behavior. All three statements are correct.
How can a Double-Ended Queue (Deque) simulate both a Stack and a Queue?
A Deque allows O(1) push/pop operations at both ends, making it capable of acting as LIFO Stack (one end) or FIFO Queue (opposite ends).