Advertisement
Guest User

1234

a guest
Dec 14th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. struct Osoba{
  7. string imie, nazwisko;
  8. int rok_urodzenia;
  9. char plec;
  10. };
  11.  
  12. struct TreeNode{
  13. Osoba *data;
  14. TreeNode *left_child;
  15. TreeNode *right_child;
  16. TreeNode *parent;
  17. };
  18.  
  19.  
  20. class binaryTree{
  21. private:
  22. TreeNode *root; //korzen
  23. public:
  24. binaryTree();
  25. ~binaryTree();
  26.  
  27. bool add_root(Osoba *o);
  28. bool add_left_child(Osoba *o, TreeNode *parent);
  29. bool add_right_child(Osoba *o, TreeNode *parent);
  30. bool modify(TreeNode *n, string imie, string nazwisko, int rok);
  31. void delete_leaf(TreeNode *n);
  32. void delete_node(TreeNode *n);
  33. void make_null();
  34. TreeNode *find(string imie, string nazwisko);
  35.  
  36. void print_root();
  37. void print_osoba(TreeNode *n);
  38. TreeNode *get_root();
  39.  
  40.  
  41. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement