Tree/BinaryTreeNonRecursivePost.c
void createTree(TreeNode** T, char* data, int* index) {
    char ch;
    ch = data[*index];
    *index += 1;
    if (ch == '#') {
        // 此时为空节点
        *T = NULL;
    }
    else {
        // 此时不为空
        *T = (TreeNode*)malloc(sizeof(TreeNode));
        (*T) -> data = ch;
        (*T) -> flag = 0;
        // 创建左子树，逻辑一致，进行递归
        createTree(&((*T)->lchild), data, index);
        // 创建右子树，逻辑一致，进行递归
        createTree(&((*T)->rchild), data, index);
    }
}
/**
 * use the char sequence to create a binary tree use pre order
 * @param T the second level of tree root node
 * @param data char sequence
 * @param index the index of char sequence
 */
use the char sequence to create a binary tree use pre order
@param T the second level of tree root node
@param data char sequence
@param index the index of char sequence
use the char sequence to create a binary tree use pre order @param T the second level of tree root node @param data char sequence @param index the index of char sequence
void createTree(TreeNode** T, char* data, int* index) {
    char ch;
    ch = data[*index];
    *index += 1;
    if (ch == '#') {
        *T = NULL;
    }
    else {
        *T = (TreeNode*)malloc(sizeof(TreeNode));
        (*T) -> data = ch;
        (*T) -> flag = 0;
        createTree(&((*T)->lchild), data, index);
        createTree(&((*T)->rchild), data, index);
    }
}
void createTree ( TreeNode * * T , char * data , int * index ) { char ch ; ch = data [ * index ] ; * index += 1 ; if ( ch == ' ' ) { * T = NULL ; } else { * T = ( TreeNode * ) malloc ( sizeof ( TreeNode ) ) ; ( * T ) -> data = ch ; ( * T ) -> flag = 0 ; createTree ( & ( ( * T ) -> lchild ) , data , index ) ; createTree ( & ( ( * T ) -> rchild ) , data , index ) ; } }
use the char sequence to create a binary tree use pre order
 @param T the second level of tree root node
 @param data char sequence
 @param index the index of char sequence
use the char sequence to create a binary tree use pre order @param T the second level of tree root node @param data char sequence @param index the index of char sequence
// 此时为空节点 // 此时不为空 // 创建左子树，逻辑一致，进行递归 // 创建右子树，逻辑一致，进行递归