i get a stack error
template <class KT, class DT>
void my_bst<KT,DT>::show_bst_structure() const
{
my_bst_node<KT,DT>* b=root;
show_bst_structure(b,0);
}
template <class KT, class DT>
void my_bst<KT,DT>::show_bst_structure(my_bst_node<KT,DT>*& p, int level) const
{
int i;
if ( root == NULL )
{
for ( i = 0; i < level; i++ )
{
putchar ( '\t' );
puts ( "~" );
}
}
else
{
if(p->left!=NULL)
{
show_bst_structure(root->left, level + 1 );
for ( i = 0; i < level; i++ )
{
putchar ( '\t' );
printf ( "%d\n", root->data );
}
}
else if(p->right!=NULL)
{
show_bst_structure( root->right, level + 1 );
for ( i = 0; i < level; i++ )
{
putchar ( '\t' );
printf ( "%d\n", root->data );
}
}
}
}