Good day. There is a binary search tree. It is necessary to balance it, but it is impossible to make an array of objects from the tree. In theory, it should be something like this, but for some reason, not all elements fall into an array.
void GetMassive(int &n, tree_node * root, DataM *M) { if (root!=NULL) { GetMassive(n,root->left,M); M[n++] = root->info; GetMassive(n,root->right,M); } }
whileshould beif- dirariaint na global variable, or replaceint nwithint &n- diraria