Thursday, March 25, 2010

Discrete Mathmatics




-Ask the user for the required number of initial values.
-Determine the next 19 values according to the given recurrence relation.
-Output the resulting 19 values along with the values for the two representative functions provided

Recursive functions are useful when you cannot decide which route to take with a particular problem, you can save time by testing different results with recursive functions. Although they can be memory hogs becuase they call themselves until the problem is solved.


This took a lot of planning out on paper in order to visualize correctly on how the program would flow. What i had a real hard time grasping was how i would take the user input which was in an array, and plug it into my function that executed the recursive algorithm. From there i also had to print out the appropiate number to the screen, which was another toughy. I used a for loop and incremented the number n to 18. Each cycle would print out and execute the algorithms.

No comments: