Question 56
Convert the infix expression A + B * C - D into its equivalent postfix notation:
B * C has higher precedence -> B C *. Then A + (B C *) -> A B C * +. Finally - D -> A B C * + D -.
Convert the infix expression A + B * C - D into its equivalent postfix notation:
B * C has higher precedence -> B C *. Then A + (B C *) -> A B C * +. Finally - D -> A B C * + D -.
Evaluate the prefix expression: - + * 2 3 4 5:
Evaluate right-to-left: * 2 3 = 6. + 6 4 = 10. - 10 5 = 5.
Which condition indicates that a Circular Queue implemented in a fixed-size array of capacity N with front and rear pointers is FULL?
In a circular queue of size N using one slot as a sentinel/buffer, full condition is (rear + 1) % N == front.
Given a queue initialized with elements [10, 20, 30, 40, 50] (where 10 is at front). We dequeue 2 elements, enqueue 60, and dequeue 1 element. What is the element at the front now?
Initial: 10, 20, 30, 40, 50. Dequeue 2 -> 30, 40, 50. Enqueue 60 -> 30, 40, 50, 60. Dequeue 1 -> 40, 50, 60. Front element is 40.
How many minimum stacks are required to implement a First-In-First-Out (FIFO) Queue queueing mechanism?
A FIFO queue can be implemented using two stacks: an input stack and an output stack. Moving elements between the two stacks reverses the LIFO order to achieve FIFO behavior.