void postorder_helper(struct node *root, int *arr, int *i){ if (root) { postorder_helper(root->left, arr, i); postorder_helper(root->right, arr, i); arr[*i] = root->data; (*i)++; } }
void postorder_helper(struct node *root, int *arr,int *ind){ if (root == NULL) return; postorder_helper(root->left, arr,ind); postorder_helper(root->right, arr,ind); arr[*ind] = root->data; *ind = *ind + 1; }
void postorder(struct node *root, int *arr) { int i = 0; if (root && arr) { postorder_helper(root, arr, &i); } }
void postorder(struct node *root, int *arr){ if (arr == NULL) return; int ind = 0; postorder_helper(root, arr, &ind); }