I am looking to use tree sort in order to store the numbers sorted in an array as opposed to just outputting the numbers in a sorted order. n is initialized to zero.
void BinSearchTree::inOrder( TreeNodePtr subRoot, int A[], int n )
{
if ( subRoot != NULL )
{
inOrder( subRoot->left, A, n );
A[n] = subRoot->key;
n++;
inOrder( subRoot->right, A, n );
}
}
I believe the problem lies where I continue to call A as a parameter for inOrder but I don't know how else I would do this.