Presentation is loading. Please wait.

Presentation is loading. Please wait.

) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression.

Similar presentations


Presentation on theme: ") Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression."— Presentation transcript:

1 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r

2 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r + 0 Init: Push + and 0 onto the stacks

3 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 0000 Lparen: Push + and 0 onto the stacks

4 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 0000 Number: Pop + and 0 from the stacks,

5 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 0000 Number: Pop + and 0 from the stacks, add the 7 7

6 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r + 7070 Number: Pop + and 0 from the stacks, add the 7 and stack the result

7 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 7070 Operator: Push the + onto the stack

8 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++++ 070070 LParen: Push a + and 0 onto the stacks

9 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++++ 070070 Number: Pop a + and 0 from the stacks

10 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++++ 070070 Number: Pop a + and 0 from the stacks add the 3 3

11 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 370370 Number: Pop a + and 0 from the stacks add the 3, stack the result

12 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 370370 Operator: Push a * onto the stack

13 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 03700370 LParen: Push a + and 0 onto the stacks

14 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 03700370 Number: Pop the + and 0 from the stacks

15 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 03700370 Number: Pop the + and 0 from the stacks add the 4 4

16 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 43704370 Number: Pop the + and 0 from the stacks add the 4, stack the result

17 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 43704370 Operator: Push the + onto the stack

18 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 43704370 Number: Pop the + and 4 from the stacks

19 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 43704370 Number: Pop the + and 4 from the stacks, add the read 4 4

20 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 83708370 Number: Pop the + and 4 from the stacks, add the read 4, stack the result

21 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 870870 RParen: Pop the * and 8 and 3 from the stacks, 3

22 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 7070 RParen: Pop the * and 8 and 3 from the stacks, multiply the two 24

23 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 24 7 0 RParen: Pop the * and 8 and 3 from the stacks, multiply the two, push the result

24 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 24 7 0 Operator: Push the * onto the stack

25 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 24 7 0 Number: Pop the * and 24 from the stacks

26 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 24 7 0 Number: Pop the * and 24 from the stacks, multiply by the read 2 2

27 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 48 7 0 Number: Pop the * and 24 from the stacks, multiply by the read 2, stack the 48

28 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 48 7 0 Operator: Push the * onto the stack

29 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 48 7 0 Number: Pop the * and 48 from the stacks

30 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 48 7 0 Number: Pop the * and 48 from the stacks, multiply the 2 and 48 2

31 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 96 7 0 Number: Pop the * and 48 from the stacks, multiply the 2 and 48, stack the 96

32 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 96 7 0 Operator: Push the * onto the stack

33 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 0 96 7 0 LParen: Push a + and 0 onto the stacks

34 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 0 96 7 0 Number: Pop the + and 0 from the stacks

35 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 0 96 7 0 Number: Pop the + and 0 from the stacks, add the 1 1

36 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 1 96 7 0 Number: Pop the + and 0 from the stacks, add the 1, stack the result

37 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 1 96 7 0 Operator: Push the + onto the stack

38 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 1 96 7 0 Number: Pop the + and 1from the stacks

39 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r +*+++*++ 1 96 7 0 Number: Pop the + and 1from the stacks, add the 2 and 1 2

40 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 3 96 7 0 Number: Pop the + and 1from the stacks, add the 2 and 1, stack the result

41 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *++*++ 370370 RParen: Pop the * and 3 and 96 from stacks, 96

42 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 288 7 0 RParen: Pop the * and 3 and 96 from stacks, multiply 96 and 3 and stack the result

43 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r ++++ 288 0 RParen: Pop the + and 7 and 288 from stacks, 7

44 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r + 295 0 RParen: Pop the + and 7 and 288 from stacks, add 7 and 288 and stack the result

45 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *+*+ 295 0 Operator: Push the * onto the stack

46 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *+*+ 295 0 Number: Pop the * and 295 from the stacks

47 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r *+*+ 295 0 Number: Pop the * and 295 from the stacks, multiply the read 3 and 295 3

48 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r + 885 0 Number: Pop the * and 295 from the stacks, multiply the read 3 and 295, stack it

49 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r + 885 RParen: Pop the + and 0 and 885 from stacks 0

50 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r 885 RParen: Pop the + and 0 and 885 from stacks, add the 0 and 885 and stack the result

51 ) Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression ( Start Operato r 885 Done: Result is in Operands stack: 885


Download ppt ") Number ) Operator ) Number (7 + (3 * (4 + 4) * 2 * 2 * (1 + 2) ) * 3) OperatorOperands Stacks Using Two Stacks to Evaluate a Simple Arithmetic Expression."

Similar presentations


Ads by Google