void Binary_search_tree::inorder_helper(BST_node* t) { if (t != nullptr) { inorder_helper(t->get_left_child()); std::cout << t->get_data() << " "; inorder_helper(t->get_right_child()); } }
void inorder_helper(struct node *root, int *arr, int *i){ if (root) { inorder_helper(root->left, arr, i); arr[*i] = root->data; (*i)++; inorder_helper(root->right, arr, i); } }
void inorder_helper(struct node *root, int **arr, int *index) { if (root != NULL && arr!=NULL) { inorder_helper(root->left, arr,index); arr[(*index)++] = &root->data; inorder_helper(root->right, arr,index); } }
void inorder_helper(struct node *root, int *arr, int *ind){ if (root == NULL) return; inorder_helper(root->left, arr,ind); arr[*ind] = root->data; *ind = *ind + 1; inorder_helper(root->right, arr,ind); }
void inorder(struct node *root, int *arr) { int i = 0; if (root && arr) { inorder_helper(root, arr, &i); } }
void inorder(struct node *root, int *arr){ if (arr == NULL) return; int ind=0; inorder_helper(root, arr, &ind); }
void Binary_search_tree::inorder() { inorder_helper(root); std::cout << "\n"; }
void inorder(struct node *root, int **arr) { int index = 0; inorder_helper(root,arr,&index); }