We covered this in class today. I understand the mechanics of it, but aside from being a nice example of recursion does it serve any purpose?
Searching the web reveals lots of pages with the formula and it's implementation in code, some talk about the author, but nothing about it's purpose.
Asked By : bot_bot
Answered By : luigif
You might use it to evaluate the performance of programming languages:
http://en.wikipedia.org/wiki/Tak_%28function%29
since recursive methods are pretty useful for benchmarking. In particular, deep recursion tests the speed with which a language can make method calls. This is important because modern applications have a tendency to spend much of their time calling various API functions.
You will also need it to solve ballot problems like this one:
Suppose A and B are candidates for office and there are 2n voters, n voting for A and n for B. In how many ways can the ballots be counted so that B is never ahead of A?
http://mathworld.wolfram.com/BallotProblem.html
or just to generate Takeuchi Numbers:
0, 1, 4, 14, 53, 223, 1034, 5221, 28437, ...
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/6815
0 comments:
Post a Comment
Let us know your responses and feedback