Last time | Next time |
Generally: $C(n)=3n$ is the closed form of the operation count.
Recursively: $C(n)=C(n-1)+3$, with $C(0)=0$.
Generally: $H(n)=2n$ is the closed form of the operation count.
Recursively: $H(n)=H(n-1)+2$, with $H(0)=0$.
So you save $n$ ops by computing your polynomials in Horner form.
rather than doing
You were on a roll! -- the successive Fibonacci numbers lend themselves to that, because the quotients $q_i$ are 1, except for the last one.
It is also the tool by which we come to the realization that infinity comes in various sizes....
In particular, permit me to share with you the story of Motel $\infty$....
(coded up following our author's algorithm, in section 3.3, p. 214, as closely as possible).