设所考虑单链表含头结点,写出逆序输出表中元素的递归算法。
void inv_trav_recur( link_list p )
{
if( p != NULL )
{
inv_trav_recur( p->next );
printf( "%d ", p->data );
}
}
void inverse_traverse_llist( link_list lst )
{
if( lst != NULL )
inv_trav_recur( lst->next );
else
printf( "The list is empty!" );
putchar( '\n' );
}