name;
printTree(value->right);
printTree(value->left);
}
tree *addData(string name){
tree *newData=new tree();
newData->name=name;
newData->left=newData->right=nullptr;
return newData;
}
int main(){
tree *head=addData("Abulqosim");
/*
Abulqosim
/ \
Nargiza Feruza
/ \ / \
Ozoda Muslima Lola Madina
*/
head->left=addData("Nargiza");
head->left->left=addData("Ozoda");
head->left->right=addData("Muslima");
head->right=addData("Feruza");
head->right->right=addData("Madina");
head->right->left=addData("Lola");
printTree(head);
return 0;
}
Dostları ilə paylaş: