1 2 2 3 3 4
play

1 2 2 3 3 4 Must Get Same Answer As Manual Solution! Preserve - PowerPoint PPT Presentation

1 2 2 3 3 4 Must Get Same Answer As Manual Solution! Preserve The Mathematical Order Of Operations 69 ? 5 + 2 ^ 3 ^ 2 = _______ 517 ? Other ? 5 Maybe A Spreadsheet Will Help? 5 + 2 ^ 3 ^ 2 = _______ 69 ? 517 ? Maybe Not! 6


  1. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 2 ICP = 3 > ISP = -1  Push 1 Postfix = 2 3 + 0 Info 5 Max ( ISP -1 -1 43 Top

  2. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * ( 2 + 3 ) * ( 5 – 2 ) 5 4 3 ( ICP = 7  Always PUSH opener to stack) 2 1 Postfix = 2 3 + * 0 Info 5 Max ( ISP 4 0 44 Top

  3. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 2 Write Operand To Postfix String ( 1 Postfix = 2 3 + 5 * 0 Info 5 Max ( ISP 0 1 45 Top

  4. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 ICP = 1 > ISP = 0  Push 2 ( 1 * 0 Postfix = 2 3 + 5 Info 5 Max ( ISP 0 1 46 Top

  5. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 - 2 Write Operand To Postfix String ( 1 * 0 2 Postfix = 2 3 + 5 Info 5 Max ( ISP 1 2 47 Top

  6. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 - 2 Scope Closer – Pop & Add To Postfix ( 1 * 0 - Postfix = 2 3 + 5 2 Info 5 Max ( ISP 1 2 48 Top

  7. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 2 Done – Pop Stack & Add To Postfix 1 * 0 Postfix = 2 3 + 5 2 - * Info 5 Max ( ISP 2 0 49 Top

  8. To Form Postfix ICP ISP • Examine one Infix character at a time – left to right + - • If Operand, Write it to the Postfix String 1 2 • If Scope Opener or Operator * / • If the In-Coming Priority (ICP) is greater than the In-Stack 3 4 Priority (ISP) Push ^ 6 5 • If ICP < ISP Pop – Write Values To Postfix Until Can Push • If Scope Closer, Pop till find opener – Write values to ({[ 7 0 Postfix – Throw out scope opener! • Empty Stack – Write Values To Postfix )}] - 2 3 + 5 2 - * 5 ( 2 + 3 ) * ( 5 – 2 ) 4 3 It is finished – Success! – Stack Is Empty! 2 1 0 Postfix = 2 3 + 5 2 - * Info 5 Max ( ISP 2 -1 50 Top

  9. 51

  10. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 5 Postfix = 1 0 Info 5 Max ISP = -1 -1 52 Top

  11. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 ICP = 1 > ISP -1  PUSH ({[ 7 0 )}] - 5 4 3 2 Postfix = 5 1 0 Info 5 Max ISP = -1 -1 53 Top

  12. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 2 Postfix = 5 1 + 0 Info 5 Max ISP = 1 0 54 Top

  13. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 ICP = 6 > ISP 2  PUSH ({[ 7 0 )}] - 5 4 3 2 Postfix = 5 2 1 + 0 Info 5 Max ISP = 2 0 55 Top

  14. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 ({[ 7 0 Write Operand To Postfix String )}] - 5 4 3 2 Postfix = 5 2 3 ^ 1 + 0 Info 5 Max ISP = 5 1 56 Top

  15. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 ICP = 6 > ISP 5  Push ({[ 7 0 )}] - 5 4 3 2 Postfix = 5 2 3 ^ 1 + 0 Info 5 Max ISP = 5 1 57 Top

  16. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 ({[ 7 0 Write Operand To Postfix String )}] - 5 4 3 ^ 2 Postfix = 5 2 3 2 ^ 1 + 0 Info 5 Max ISP = 5 2 58 Top

  17. 5 2 3 2 ^ ^ + ICP ISP + - 1 2 Infix = 5 + 2 ^ 3 ^ 2 * / 3 4 ^ 6 5 ({[ Done – Pop Stack & Add To Postfix 7 0 )}] - 5 4 3 ^ 2 ^ ^ + Postfix = 5 2 3 2 ^ 1 + 0 Info 5 Max ISP = 5 2 59 Top

  18. 60

  19. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 – 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 3 Postfix = 1 0 Info 5 Max ISP = -1 -1 61 Top

  20. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ICP = 3 > ISP = -1  Push * ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 1 0 Info 5 Max ISP = -1 -1 62 Top

  21. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 2 Postfix = 3 1 * 0 Info 5 Max ISP = 4 -1 63 Top

  22. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ICP = 1 < ISP = 4  Pop * Add To ({[ 7 0 Postfix & Try Again! Push + )}] - 5 4 3 2 * Postfix = 3 2 1 * 0 Info 5 Max ISP = 4 -1 64 Top

  23. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 1 + 0 Info 5 Max ISP = 2 -1 65 Top

  24. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ICP = 1 < ISP = 2  Pop + Add To ({[ 7 0 Postfix & Try Again! Push - )}] - 5 4 3 2 Postfix = 3 2 * 3 + 1 + 0 Info 5 Max ISP = 2 -1 66 Top

  25. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 1 - 0 Info 5 Max ISP = 2 -1 67 Top

  26. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ICP = 3 > ISP = 2  Push / ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 1 - 0 Info 5 Max ISP = 2 -1 68 Top

  27. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 2 / 1 - 0 Info 5 Max ISP = 2 0 69 Top

  28. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ICP = 3 < ISP = 4  Pop / Add To ({[ 7 0 Postfix & Try Again! Push / )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 2 / / 1 - 0 Info 5 Max ISP = 4 1 70 Top

  29. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 2 / / 2 1 - 0 Info 5 Max ISP = 4 1 71 Top

  30. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ICP = 1 < ISP = 4  Pop / Add To ({[ 7 0 Postfix & Try Again! Pop  Add To )}] - Postfix & Try Again! Push - 5 4 3 2 Postfix = 3 2 * 3 + 4 2 / 2 / - / 1 - 0 Info 5 Max ISP = 4 1 72 Top

  31. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 2 / 2 / - 3 1 - 0 Info 5 Max ISP = 2 0 73 Top

  32. 3 2 * 3 + 4 2 / 2 / - 3 - ICP ISP + - 1 2 Infix = 3 * 2 + 3 – 4 / 2 / 2 - 3 * / 3 4 ^ 6 5 ({[ Done  Pop Stack & Add To Postfix 7 0 )}] - 5 4 3 2 Postfix = 3 2 * 3 + 4 2 / 2 / - 3 - 1 - 0 Info 5 Max ISP = 2 0 74 Top

  33. 75

  34. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ( ICP = 7  Always PUSH opener to stack) ({[ 7 0 )}] - 5 3 2 3 2^ ^ 4 5 4 - * 1* / + 2 * 4 3 2 Postfix = 1 0 Info 5 Max ISP = -1 -1 76 Top

  35. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 3 Postfix = 1 ( 0 Info 5 Max ISP = 0 0 77 Top

  36. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ICP = 1 > ISP = 0  Push + ({[ 7 0 )}] - 5 4 3 2 3 Postfix = 1 ( 0 Info 5 Max ISP = 0 0 78 Top

  37. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 + 1 ( 0 Info 5 Max ISP = 2 1 79 Top

  38. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ICP = 6 > ISP = 2  Push ^ ({[ 7 0 )}] - 5 4 3 2 Postfix = 3 2 + 1 ( 0 Info 5 Max ISP = 2 1 80 Top

  39. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 3 ^ 2 Postfix = 3 2 3 + 1 ( 0 Info 5 Max ISP = 5 2 81 Top

  40. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ICP = 6 > ISP = 5  Push ^ ({[ 7 0 )}] - 5 4 3 ^ 2 Postfix = 3 2 3 + 1 ( 0 Info 5 Max ISP = 5 2 82 Top

  41. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 ^ 3 ^ 2 Postfix = 3 2 3 2 + 1 ( 0 Info 5 Max ISP = 5 2 83 Top

  42. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ICP = 3 < ISP = 5  Pop ^Add To ({[ 7 0 Postfix & Try Again! Pop ^Add To )}] Postfix & Try Again! Push / - 5 4 ^ 3 ^ 2 Postfix = 3 2 3 2 ^ ^ + 1 ( 0 Info 5 Max ISP = 5 3 84 Top

  43. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 (ICP = 7 > ISP = 4  Push ({[ 7 0 Always PUSH opener to stack )}] - 5 4 3 / 2 Postfix = 3 2 3 2 ^ ^ + 1 ( 0 Info 5 Max ISP = 4 2 85 Top

  44. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 5 4 { 3 / 2 Postfix = 3 2 3 2 ^ ^ 4 + 1 ( 0 Info 5 Max ISP = 0 3 86 Top

  45. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ICP = 3 > ISP = 0  Push * ({[ 7 0 )}] - 5 4 { 3 / 2 Postfix = 3 2 3 2 ^ ^ 4 + 1 ( 0 Info 5 Max ISP = 0 3 87 Top

  46. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 (ICP = 7 > ISP = 4  Push ({[ 7 0 Always PUSH opener to stack )}] - 5 * 4 { 3 / 2 Postfix = 3 2 3 2 ^ ^ 4 + 1 ( 0 Info 5 Max ISP = 4 4 88 Top

  47. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - [ 5 * 4 { 3 / 2 Postfix = 3 2 3 2 ^ ^ 4 5 + 1 ( 0 Info 5 Max ISP = 0 5 89 Top

  48. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 (ICP = 1 > ISP = 0  Push ({[ 7 0 Always PUSH opener to stack )}] - [ 5 * 4 { 3 / 2 Postfix = 3 2 3 2 ^ ^ 4 5 + 1 ( 0 Info 5 Max ISP = 0 5 90 Top

  49. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - - 6 [ 5 * 4 { 3 Postfix = 3 2 3 2 ^ ^ 4 5 4 / 2 + 1 ( 0 Info ISP = 1 5 91 Top

  50. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Pop Stack Till Find Matching ({[ 7 0 Opener  Add - To Postfix )}] - - 6 [ 5 * 4 { 3 Postfix = 3 2 3 2 ^ ^ 4 5 4 - / 2 + 1 ( 0 Info ISP = 1 5 92 Top

  51. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 (ICP = 1 > ISP = 4  Pop *Add To ({[ 7 0 Postfix & Try Again! Push - )}] - 6 5 * 4 { 3 Postfix = 3 2 3 2 ^ ^ 4 5 4 - * / 2 + 1 ( 0 Info ISP = 4 4 93 Top

  52. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 6 5 * 4 { 3 Postfix = 3 2 3 2 ^ ^ 4 5 4 - * 1 / 2 + 1 ( 0 Info ISP = 2 4 94 Top

  53. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Pop Stack Till Find Matching ({[ 7 0 Opener  Add - To Postfix )}] - 6 5 * 4 { 3 Postfix = 3 2 3 2 ^ ^ 4 5 4 - * 1 * / 2 + 1 ( 0 Info ISP = 2 4 95 Top

  54. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Pop Stack Till Find Matching ({[ 7 0 Opener  Add - To Postfix )}] - 6 5 4 3 Postfix = / 2 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + + 1 ( 0 Info ISP = 4 2 96 Top

  55. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 (ICP = 3 > ISP = -1  Push * ({[ 7 0 )}] - 6 5 4 3 Postfix = 2 1 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 0 Info ISP = -1 -1 97 Top

  56. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 Write Operand To Postfix String ({[ 7 0 )}] - 6 5 4 3 Postfix = 2 1 2 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + * 0 Info ISP = 4 0 98 Top

  57. 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * ICP ISP + - 1 2 ( 3 + 2 ^ 3 ^ 2 / { 4 * [ 5 – 4 ] * 1 } ) * 2 * / 3 4 ^ 6 5 ({[ 7 0 )}] - 6 5 Done  Pop Stack & Add To Postfix 4 3 Postfix = 2 1 3 2 3 2 ^ ^ 4 5 4 - * 1 * / + 2 * * 0 Info ISP = 4 0 99 Top

  58. What type of stack was to create the Postfix from the Infix? Scala: var st = new charStack(50) Stack <char> Postfix(5); 100

Recommend


More recommend