Question: Code in python using recursion Purpose The programming assignment will provide an exercise in using recursion. There are two problems which need to be solved.

Code in python using recursion

Code in python using recursion Purpose The programming assignment will provide an

Purpose The programming assignment will provide an exercise in using recursion. There are two problems which need to be solved. The first asks for a recursive function to calculate a Catalan number. The second is to solve a path-finding problem in two dimensional space. The assignment will require the usage of recurrence as well as good class design. Problem 1: The good Mr. Catalan. The Catalan number form a sequence of natural numbers that occur in many counting problems. They are named after the mathematician Eugene Charles Catalan (http://en.wikipedia.org/wiki/Eug%C3%A8ne Charles Catalan) and are defined by the following recursive formula: n Co = 1 and Cn+1 = > CiCn-i for n 2 0; 1=0 Write a program called Catalan which takes one argument and calls a recursive function which computes the nth Catalan number. The program then prints out the result to the console. For instance, python catalan.py 4 Would print out: 14 python catalan.py 10 Would print out: 16796

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!