retagged by
17,061 views

1 Answer

0 votes
0 votes

6 2 3 * /  4 2 * + 6 8 * -

Push 6 into stack, Push 2 into stack, Push 3 into stack

Now we encounter operator, So pop top 2 elements and apply operator between them, it should be like

( second_pop operator first_pop ) ==> 2 * 3 but not 3 * 2

result is 6 ==> push into the stack.

 

Now we encounter operator, So pop top 2 elements and apply operator between them, it should be like

( second_pop operator first_pop ) ==> 6 / 6

result is 1 ==> push into the stack.

 

Push 4 into stack, Push 2 into stack

Now we encounter operator, So pop top 2 elements and apply operator between them, it should be like

( second_pop operator first_pop ) ==> 4 * 2

result is 8 ==> push into the stack.

 

question is asking about till evaluate upto 2$^{nd}$ * evaluated, ==> our task complete

Top of the two elements of our stacks is 8,1 in the order from top to bottom

Answer:

Related questions

0 votes
0 votes
2 answers
2
Arjun asked Jan 2, 2019
5,794 views
A binary search tree is constructed by inserting the following numbers in order :$60, 25, 72, 15, 30, 68, 101, 13, 18, 47, 70, 34$The number of nodes in the left subtree ...
1 votes
1 votes
2 answers
3
Arjun asked Jan 2, 2019
2,844 views
Consider a singly linked list. What is the worst case time complexity of the best-known algorithm to delete the node $a$, pointer to this node is $q$, from the list?$O(n ...