する#include <stdio.hに> する#include <STDLIB.H> の#define MAXSIZE 127 のtypedef チャーTElemType。 typedef 構造体ノード{ TElemTypeデータ[MAXSIZE]。 TElemType N; } SqBTree。 ボイド createBTree(SqBTree&T、TElemType予め[]、INT nは、INT&M){ TElemType CH = [M ++プリ]。 もし(CH == ' ; ')のリターン; もし(!CH = ' #' ){ T.data [N] = CHと、 createBTree(T、予め、N- * 2 + 1 、M); createBTree(T、予め、N * 2 + 2 、M)。 } } ボイド CreatEmptyBTree(SqBTree&T){ ため(int型 i = 0 ; iは<MAXSIZE iは++ ){ T.data [I] = ' #' 。 } } ボイド PrintBTree(SqBTree&T、int型N){ 場合(t.data [N]!= ' #' ){ のprintf(" %のC "、t.data [N])。 printf(" (" ); PrintBTree(T、N * 2 + 1 ); のprintf(" " ); PrintBTree(T、N * 2 + 1 ); のprintf(" )" )。 } } int型のmain(){ SqBTree BT。INT、N = 0 。 INT、M = 0 。 CHAR CH [] = { ' A '、' B '、' C '、' #'、' #'、' D '、' E '、' #'、' #'、' #'、' 。' }; CreatEmptyBTree(BT)。 createBTree(BT、CH、N、M)。 PrintBTree(BT、N)。 }