()stack[tp]=t () p=stack[tp] ()p ()++tp
① 本算法將二叉樹的左右子樹交換
② ()new (s) //初始化申請結點
() s^next=NIL //s是帶頭結點的鏈棧
()s^next^data //取棧頂元素
()s^next:= p^next //棧頂指針下移
()dispose(p) //回收空間
()p^next:=s^next //將新結點入鏈棧
()push(sp^rchild) //先沿樹的左分支向下將p的右子女入棧保存
()NOT empty(s)
() finishe:=true //已完成
()finish=true (或s^next=NIL)
[] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/23154.html