Hi!
I have a problem with this recursive function. Tell me what changes variables i and j.
Code:
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <ctype.h>
# define MAX 1001
typedef struct st
{
int dat;
struct st *left;
struct st *right;
};
typedef struct st* OBST;
BST B_Tree(int i, int j)
{
OBST New = (OBST)malloc(sizeof(struct st));
int x;
if(i == j)
{
New = NULL;
return New;
}
else
{
x = r[i][j];
New->dat = keys[x]; //write key
New->right = B_Tree(x, j); //repeat
New->left = B_Tree(i, x-1);
printf ("\ni = %d\tj = %d\tx = %d", i, j, x);
return New;
}
}
int main ()
{
OBST root;
root = B_Tree(0, 1000);
return 0;
}