()new(t) ()*i≤n ()t^lchild*i ()*i+≤n ()t^rchild*i+ ()
()Push(sp) ()K= ()p>data=ch ()BT=p () ins>>ch
()result; ()p:=p^link; () q:=q^pre ((2)(3)順序可變)
()top++ () stack[top]=p>rchild ()top++ ()stack[top]=p>lchild
.()(i<=j) AND (x<=y) ()A[i]<>B[k] ()kx ()creatBT(i+i+Lxks^lchild) () creatBT(i+L+jk+ys^rchild)
()push(sbt) ()pop(s) ()push(sp^rchild) // p的右子樹進棧
.() p=p>lchild // 沿左子樹向下 ()p=p>rchild
.() ()hl>hr ()hr=hl
()top> ()t* // 沿左分枝向下 ()top // 退棧
[] [] [] [] [] [] [] [] [] []
From:http://tw.wingwit.com/Article/program/sjjg/201311/23153.html