36 Tree* parent =
nullptr;
43 explicit Tree(
const T& data) :
49 for(
auto* child : children)
68 this->children << node;
76 auto* node =
new Tree(data);
87 auto it = std::find_if(children.begin(), children.end(), [&](
const auto* node){
88 return (node == deletedNode);
91 if(it != children.end()) {
94 node->parent =
nullptr;
107 if(children.isEmpty()) {
111 auto lambda = [](
auto* tree1,
auto* tree2) {
112 return (tree1->data < tree2->data);
115 std::sort(children.begin(), children.end(), lambda);
119 for(
auto* child : children)
121 child->sort(recursive);
Definition: EngineUtils.h:33
The Tree class.
Definition: Tree.h:34
void sort(bool recursive)
sort children of all nodes in ascending way according to their data
Definition: Tree.h:105
Tree * addChild(Tree *node)
adds a child to the given node
Definition: Tree.h:64
Tree * removeChild(Tree *deletedNode)
remove a node from the current node
Definition: Tree.h:85
Helper functions.
Definition: Utils.h:38