Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

? asked in 電腦與網際網路程式設計 · 1 decade ago

請教計算機概論Postfix expression執行結果?

問題如下:

Postfix expression 2 3 4 + 5 * + 其執行結果為何?

answer:37

PS:麻煩說明演算過程

及樹狀排列圖,例如下:

A

/ \

B C

/ \

D E

Update:

&#92 為斜線

2 Answers

Rating
  • Kathy
    Lv 4
    1 decade ago
    Favorite Answer

    此題目為後序排序,規則為兩個運算元後面對應一個運算子

    過程如下:

    234+5*+ => 2(3+4)5*+ => 2(7*5)+ => 2+35 => 37

    您說的樹狀排列圖,應該是二元樹狀圖巴,如下

    /\

    2  *

    /\

    +  5

    /\

    3 4

    2009-12-16 15:45:31 補充:

    好多年前課本中學到的印象,其中二元樹狀圖有錯還請各位高手賜教

    Source(s): , me
  • 1 decade ago

    (0)

    +

    / \

    2 *

    /

    \

    + 5

    / \

    3 4

    +

    / \

    2 *

    /

    \

    7 5

    (2)

    +

    / \

    2 35

    (3)

    37

Still have questions? Get your answers by asking now.