<commit_before>package ru.aserdyuchenko.tree.task_4;

import java.util.Iterator;
import java.util.Stack;

/**
 * @author <NAME>. <EMAIL>
 */
public class Tree<E extends Comparable<E>> {
    private Node<E> root;

    public boolean breadthFirstSearch() {
        try {
            breadthFirstSearch(root);
            breadthFirstSearch(root.right);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    private void breadthFirstSearch(Node<E> node) {
        Node<E> temp = node.left;
        node.left = node.right;
        node.right = temp;
        if (node.left != null) depthFirstSearch(node.left);<commit_msg>Исправил решение задачи: Реализовать зеркальный переворот дерева.[#19111]<commit_after>package ru.aserdyuchenko.tree.task_4;

import java.util.Iterator;
import java.util.Stack;

/**
 * @author <NAME>. <EMAIL>
 */
public class Tree<E extends Comparable<E>> {
    private Node<E> root;

    public boolean breadthFirstSearch() {
        try {
            Node<E> node = root;
            while (node.left != null) {
                Node<E> temp = node.left;
                node.left = node.right;
                node.right = temp;
                node = node.left;
            }

            node = root.right;
            while (node.right != null) {
                Node<E> temp = node.left;
                node.left = node.right;
                node.right = temp;
                node = node.right;
            }

            return true;
        } catch (Exception e) {
            return false;
        }
{'fraction_non_alphanumeric': 0.11280101394169835, 'fraction_numerical': 0.004435994930291508, 'mean_word_length': 1.7365684575389948, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3230543', 'n_tokens_mistral': 482, 'n_tokens_neox': 467, 'n_words': 107}