|
|
|
|
|
by terryk88a
5134 days ago
|
|
Why don't you ask "What's the least efficient way to print a string 100 times?" Unrolling loops can be a good thing when optimizing code, but you can't get much worse than tail recursion. It's always a win to eliminate this code pattern. The order of complexity is the same, but your stack will blow up for large N. I don't know what you're looking for when posing this problem. A simple loop is already the most efficient technique. loop good
tail recursion bad Of course, this is just a homework quiz, right? |
|