[HEAD]–> [ ][ ]–> [ ][/]
[HEAD]–> [ ][ ]–> [ ][ ]–> [Back to HEAD]
[HEAD]<–>[ ][ ]<–>[ ][/]
[HEAD]<–>[ ][ ]<–>[ ][ ]<–>[Back to HEAD]
BASIS f(0) = 0 in recurrence relationship Substitute 0 for n in closed form: f(0) = 3 * 0 * (0+1) / 2 = 0
INDUCTIVE ASSUMPTION Assume k is an integer, k > 0. f(k) = 3k(k+1)/2
We want to show that f(k + 1) = 3 * (k+1) * (k+2) / 2
Proof
Plug k+1 in for n in the recursive relation
f(k+1) = f(k+1 - 1) + 3(k+1)
= f(k) + 3(k+1)
= 3k(k+1)/2 + 3(k+1)
= 3k(k+1)/2 = 6(k+1)/2
= (3k(k+1) + 6(k+1))/2
= ((k+1)(3k+6))/2
= 3(k+1)(K+2)/2 QED
Note: Review using recursion to traverse a list Anything that takes a node as a parameter has to be private. <– Is this statement correct? The client can never know about nodes. Nodes are package-privte.