Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "binaryTree.h"
- using namespace::std;
- binaryTree::binaryTree(){
- root = NULL;
- }
- binaryTree::~binaryTree(){
- // make_null();
- }
- bool binaryTree::add_root(Osoba *o){
- TreeNode *n = new TreeNode;
- if(!n) return false;
- n->data = o;
- n->left_child = NULL;
- n->right_child = NULL;
- n->parent = NULL;
- root = n;
- return true;
- }
- void binaryTree::print_root(){
- cout << endl << root->data->imie;
- cout<<" "<<root->data->nazwisko;
- cout<< ", ur. w "<<root->data->rok_urodzenia;
- cout<<" roku"<< endl;
- }
- void binaryTree::print_osoba(TreeNode *n){
- cout << n->data->imie << " " << n->data->nazwisko << ", ur. w " << n->data->rok_urodzenia << endl;
- }
- TreeNode* binaryTree::get_root(){
- return root;
- }
- bool binaryTree::add_left_child(Osoba *o, TreeNode *n){
- TreeNode *p = new TreeNode;
- if(!p) return false;
- p->data = o;
- p->left_child = NULL;
- p->right_child = NULL;
- p->parent = n;
- n->left_child = p;
- return true;
- }
- bool binaryTree::add_right_child(Osoba *o, TreeNode *n){
- TreeNode *p = new TreeNode;
- if(!p) return false;
- p->data = o;
- p->left_child = NULL;
- p->right_child = NULL;
- p->parent = n;
- n->right_child = p;
- return true;
- }
- TreeNode *binaryTeee::find(string imie,string nazwisko){
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement