int get_height1(struct node *root){ if (root == NULL) return 0; int height1 = get_height1(root->right); int height2 = get_height1(root->left); return height1 > height2 ? height1 + 1 : height2 + 1; }
int get_height1(struct node *root){ if (root == NULL) return 0; int heightLeft = get_height1(root->left); int heightRight = get_height1(root->right); if (heightLeft > heightRight) return(heightLeft + 1); else return(heightRight + 1); }
int * BSTRighttoLeftRows(struct node* root) { if (root == NULL) return NULL; int ht = get_height1(root),index=0; int *arr = (int *)malloc(power(2, ht + 1)*sizeof(int)); for (int i = 0; i <= ht; i++) bstRows(root, arr, i,&index); return arr; }
int* BSTRighttoLeftRows(struct node* root) { q1 = (int *)malloc(20 * sizeof(int)); if (root == NULL) return q1; int h = get_height1(root); int i; for (i = 1; i <= h; i++) printGivenLevel(root, i); return q1; }