#include
#include
//daraxt tugunini tavsiflash uchun tuzilma
struct tree
{
int data;
struct tree *lchild, *mchild, *rchild;
};
80
struct tree *my_insert(struct tree *p,int n, int
dir);
void inorder(struct tree *p);
void preorder(struct tree *p);
void postorder(struct tree *p);
int main()
{
int x,y,i;
struct tree *root;
struct tree *node_2, *node_3, *node_5;
struct tree *node_8, *node_9, *node_6, *node_10,
*node_4, *node_7;
//daraxtni hosil qilish
root = NULL;
root = my_insert(root,1,0);
node_2 = my_insert(root,2,0);
node_3 = my_insert(root,3,1);
node_4 = my_insert(root,4,2);
node_5 = my_insert(node_3,5,0);
node_8 = my_insert(node_5,8,0);
node_9 = my_insert(node_5,9,2);
Do'stlaringiz bilan baham: |