```c
#include<stdio.h>
#include<stdlib.h>
typedef struct BinaryTreeNode
{
int data;
struct BinaryTreeNode*left;
struct BinaryTreeNode*right;
}BinaryTreeNode;
BinaryTreeNode *a[20];
BinaryTreeNode *b[20];
int front=0;
int rear=0;
int top=-1;
void push_stack(BinaryTreeNode*Node)
{
b[++top]=Node;
}
BinaryTreeNode*pop_stack()
{
BinaryTreeNode*pointer=b[top];
top--;
return pointer;
}
void push(BinaryTreeNode*Node)
{
a[rear]=Node;
rear=(rear+1)%20;
}
BinaryTreeNode* pop()
{
BinaryTreeNode*Node=a[front];
front=(front+1)%20;
return Node;
}
BinaryTreeNode* CreateNode(int data)
{
BinaryTreeNode*Node=(BinaryTreeNode*)malloc(sizeof(BinaryTreeNode));
Node->data=data;
Node->left=NULL;
Node->right=NULL;
return Node;
}
void Insert(BinaryTreeNode*root,int data)
{
BinaryTreeNode*Node=CreateNode(data);
BinaryTreeNode*pointer;
if(root==NULL) root=Node;
else
{
push(root);
while(rear!=front)
{
pointer=pop();
if(pointer->left!=NULL)
{
push(pointer->left);
if(pointer->right!=NULL)
push(pointer->right);
else
{
pointer->right=Node;
return;
}
}
else
{
pointer->left=Node;
return;}
}
}
}
void PreOrder(BinaryTreeNode*root)
{
BinaryTreeNode*pointer=root;
while(top!=-1||pointer!=NULL)
{
if(pointer!=NULL){
printf("%d",pointer->data);
push_stack(pointer);
pointer=pointer->left;
}
else{
pointer=pop_stack();
pointer=pointer->right;
}
}
}
int main()
{
BinaryTreeNode*root;
root=NULL;
Insert(root,0);
printf("%d",root==NULL);
Insert(root,1);
Insert(root,2);
Insert(root,3);
Insert(root,4);
Insert(root,5);
Insert(root,6);
PreOrder(root);
}