五、請於下方標示之【待填入程式區塊】中,以 6 行內為限填入虛擬程式碼(pseudo-code),實 現將二元樹(以鏈結串列方式儲存)中每一節點的左子樹、右子樹皆調換之功能(示意如下, 交換前二元樹如【圖 1】,交換後二元樹如【圖 2】,以 t 表示父節點之指標,t→leftchild 表示 t 的左子節點指標,t→rightchild 表示 t 的右子節點指標)。(15 分)
pointer temp; \\宣告temp指標
temp = t->leftchild;
t->leftchile = t->rightchild; \\交換左右子樹
rightchild->temp;
Swaptree(t->leftchild);
Swaptree(t->rightchild);