logo

Crowdly

Browser

Додати до Chrome

We use 2 stacks,  stack1   and  stack2  with the following initial states ...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

We use 2 stacks, stack1  and stack2 with the following initial states

stack1: 17 is on the 'top' of the stack: this is the first element to be unstacked()/popped()

stack1->172-1xx9+

stack2 is empty

we use the following algorithm:

while stack1 is not empty

      value <- pop(stack1)

      if value is a number

             push(stack2, value)

      else (value is an operator, addition or mulitplication)

             val1 <- pop(stack2)

             val2 <- pop(stack2)

             result <- apply the operator to val1 and val 2 (val1+val2 if it's an addition, val1 x val2 if it's a multiplication)

             push(result, stack2)

what value will be stored in stack2 at the end of the algorithm?

0%
0%
0%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.myefrei.fr?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome