ID
Size: a a a
ID
SM
K
ID
AM
TW
AM
IZ
TW
О
left->father = right->father = father;
О
AB
О
ID
О
struct cluster {
shared_ptr<cluster> left,right;
weak_ptr<cluster> father;
cluster(){}
cluster(shared_ptr<cluster>& left,shared_ptr<cluster>& right) {
this->left = left;
this->right = right;
}
};
int main() {
auto left = make_shared<cluster>();
auto right = make_shared<cluster>();
auto father = make_shared<cluster>(left,right);
left->father = right->father = father;
return 0;
}
О
О
SH
struct cluster {
shared_ptr<cluster> left,right;
weak_ptr<cluster> father;
cluster(){}
cluster(shared_ptr<cluster>& left,shared_ptr<cluster>& right) {
this->left = left;
this->right = right;
}
};
int main() {
auto left = make_shared<cluster>();
auto right = make_shared<cluster>();
auto father = make_shared<cluster>(left,right);
left->father = right->father = father;
return 0;
}
SH