What is asked in Q14. of quiz is not clear and it’s solution is also not provided.
Quiz On Stack And Queue
Based on the question, consider an element that is inserted in the queue at time moment t, let’s say, now, if it’s the xth element to be inserted, then after this element n - x - 1 elements more will be inserted. Using the times given, you can easily calculate the time taken to insert these remaining elements in the stack. Now begins the process of popping from the stack, now firstly n - x - 1 elements need to be removed from the stack for the chance of this particular element to come to be removed. Now, since popping and pushing take the same amount of time, you can calculate the time elapsed in popping these n - x - 1 elements and add it to the previously calculated time. This is the time between the pushing and popping of the xth element. So, now this is just for single element, Do the same for all the n elements, Calculate such times for all of them, add them up and divide by n and report the answer.
I think you’ve answered a different question. I had asked a different question: Q14. Stacks 04 The following postfix expression with single digit operands is evaluated using a stack: 8 2 3 ^ / 2 3 * + 5 1 * -
Options are A:6,1 B:5,2 C:3,2 D:1,5 and what does this question wants is unclear.
I guess you haven’t learned about postfix expression evaluation
Just read about this idea from GFG or youtube. It’s pretty simple actually. then try to solve this question and if you still don’t understand ask me again.
Arey , I know about postfix expression. I want to know what the question is demanding
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.