The nth Catalan number can be found using recursion, dynamic programming, or memoization. Here are the code snippets for each approach:
main.cs237 chars14 lines
main.cs259 chars14 lines
main.cs345 chars19 lines
And here is how you can call these functions:
main.cs143 chars5 lines
The output will be:
main.cs9 chars4 lines
which is the 5th Catalan number.
gistlibby LogSnag