Question: Define a pure, recursive function falling that implements the falling factorial function, xn (pronounced x to the falling n), defined as n factors n

Define a pure, recursive function falling that implements the falling factorial function, xn (pronounced "x to the falling n"), defined as n factors n x = x(x 1). . . (x n + 1), integer n 0 Notice the straight line under the n; this indicates that the n factors descend stepwise. By convention, the product of zero factors is 1, so x = 1 when n = 0. You may assume that x and n are both integers. The following facts may help you test your implementation: 1. n! = nn 2. x = x!/(x n)! - You can read more about the falling factorial on Wikipedia. Unlike Wikipedia, we use D. E. Knuth's notation for the falling factorial; see the book Concrete Mathematics for more. Your solution must not use the factorial function to compute the falling factorial function; instead, your implementation should be O(n). How could we write a test that, if it passed, gave us confidence that falling was not implemented using the factorial function? Hint: for what value(s) of n is the falling factorial easy to compute, but for which an implementation using factorial would take a long time to complete? Examples: (falling 10 1) => 10 (falling 10 10) => 3628800
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
