本題①是表達式求值②是在二叉排序樹中刪除值為x的結點首先查找x若沒有x則結束否則分成四種情況討論x結點有左右子樹只有左子樹只有右子樹和本身是葉子
()Postoder_eval(t^Lchild) () Postorder_eval(t^Rchild) ()ERROR(無此運算符) ()A ()tempA^Lchild
()tempA=NULL ()q^Rchild ()q ()tempA^Rchild ()tempA^Item<r^Item
() IF t=NIL THEN num:= ELSE num:=num(t^l)+num(t^r)+
() IF (t=NIL) AND (m≤n) OR (t<>NIL) AND (m>n) THEN all:=false
ELSE BEGIN chk(t^l*m);chk (t^r*m+);END
()p>rchild ()p>lchild ()p>lchild ()ADDQ(Qp>lchild) ()ADDQ(Qp>rchild)
()t>rchild!=null ()t>rchild!=null ()N++ ()count(t>lchild) ()count(t>rchild)
()p () ()height(p>lchild) () ()height(p>rchild) ()lh+ ()rh+ ()
()p<>NIL ()addx(p) ()addx(tree) ()r^rchild
[] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/23156.html