recursion (linear and tail)