Exercises

Vigenere Rail Fence

Recursive Fibonacci

Problem Descripton

The Fibonacci series is a sequence of numbers in which each number is the sum of the previous two numbers. The first two Fibonacci numbers are 1 and 1. The third number is 1 + 1 = 2, the fourth is 1 + 2 = 3, the fifth is 2 + 3 = 5, and so on. This simple sequence can easily be computed using a recursive function. A recursive function is one in which the function calls itself. For example, here is a recursive function that computes the sum of all integers between 1 and n:

Recursion Example

Write a recursive function that computes the nth Fibonacci number, where nth is an argument passed to the function.

Solving the Problem

*The blue comments below are examples of the approach.

Fibonacci Solution

Vigenere Rail Fence