algorithms using recursion simple examples 2847492