Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void rootRightLeft_print() { // КПЛ обход
- cout << "КПЛ обход " << endl;
- rootRightLeft_print(root);
- cout << endl;
- }
- void rootRightLeft_print(treenode<T> *node) {
- if (node != nullptr) {
- cout << node->data << " ";
- rootRightLeft_print(node->rightkid);
- rootRightLeft_print(node->leftkid);
- }
- }
- //////////////
- void leftRootRight_print() { // ЛКП обход
- cout << "ЛКП обход " << endl;
- leftRootRight_print(root);
- cout << endl;
- }
- void leftRootRight_print(treenode<T> *node) {
- if (node != nullptr) {
- leftRootRight_print(node->leftkid);
- cout << node->data << " ";
- leftRootRight_print(node->rightkid);
- }
- }
- /////////////////
- void print_by_levels () {
- cout << "Печать по строкам: " << endl;
- int max_level = 0;
- while (pow(2, max_level) - 2 <= root->kids) max_level ++;
- for (int i = 0; i < max_level; i ++) {
- print_mentioned_level(root, i);
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement