catalan number calculator
C++
#include<iostream>
using namespace std;
// A recursive function to find nth catalan number
unsigned long int catalan(unsigned int n)
{
// Base case
if (n <= 1) return 1;
// catalan(n) is sum of catalan(i)*catalan(n-i-1)
unsigned long int res = 0;
for (int i=0; i<n; i++)
res += catalan(i)*catalan(n-i-1);
return res;
}
// Driver program to test above function
int main()
{
for (int i=0; i<10; i++)
cout << catalan(i) << " ";
return 0;
}
Also in C++:
- Title
- do while loop c++
- Category
- C++
- Title
- c++ get last element in vector
- Category
- C++
- Title
- % operator in c++
- Category
- C++
- Title
- inverser les éléments d'un tableau manuellement en c++
- Category
- C++
- Title
- c++ for loop
- Category
- C++
- Title
- assegnare valori in c++
- Category
- C++
- Title
- solve linear equations geeksforgeeks
- Category
- C++
- Title
- c++ compiler for sublime text
- Category
- C++
- Title
- best fit algorithm
- Category
- C++
- Title
- reverse in vector c++
- Category
- C++
- Title
- c++ cli convert string to string^
- Category
- C++
- Title
- how to convert string into number
- Category
- C++
- Title
- leveling system c++
- Category
- C++
- Title
- sieve of eratosthenes c++
- Category
- C++
- Title
- what is meaning of 64 bit integer in c++
- Category
- C++
- Title
- primeros numeors primos menores que
- Category
- C++
- Title
- create new file c++
- Category
- C++
- Title
- counting valleys hackerrank solution in c++
- Category
- C++
- Title
- vector concat c++
- Category
- C++
- Title
- converting char to int in c++
- Category
- C++
- Title
- c++ max of array
- Category
- C++
- Title
- memset c++
- Category
- C++
- Title
- flake8 max line length
- Category
- C++
- Title
- how to print 5 precision float in c++
- Category
- C++
- Title
- how to convert qt string to string
- Category
- C++
- Title
- c++ empty stream
- Category
- C++
- Title
- c++ compare char
- Category
- C++
- Title
- substr c++
- Category
- C++
- Title
- array<string, 7> c++
- Category
- C++
- Title
- making random numbers in c++
- Category
- C++
- Title
- how to grab all of user input c++
- Category
- C++
- Title
- c++ loop through array
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- power in c++
- Category
- C++
- Title
- pair in c++
- Category
- C++
- Title
- recursion in cpp with reference
- Category
- C++
- Title
- body parser
- Category
- C++
- Title
- 2927260.eps 2927262.jpg 2927263.ai License free.txt License premium.txt
- Category
- C++
- Title
- size of a matrix c++
- Category
- C++
- Title
- c++ argv
- Category
- C++
- Title
- length of string in c++
- Category
- C++
- Title
- caesar cipher program in c++
- Category
- C++
- Title
- how to use wasd c++
- Category
- C++
- Title
- c++ base 10 to base 2
- Category
- C++
- Title
- quick sort predefined function in c++
- Category
- C++
- Title
- COnvert string to char * C++
- Category
- C++
- Title
- c++ replace n substrings
- Category
- C++
- Title
- placement new c++
- Category
- C++
- Title
- pass by reference c++
- Category
- C++
- Title
- how to make a 2d vector in c++
- Category
- C++
- Title
- convert stirng to int c++
- Category
- C++
- Title
- iterative preorder traversal
- Category
- C++
- Title
- can you use a return to print a string when referencing an integer c++
- Category
- C++
- Title
- c++ create array
- Category
- C++
- Title
- pointer related problems dangling/wild pointers c++
- Category
- C++
- Title
- what are the different ways to traverse a binary tree
- Category
- C++
- Title
- time conversion hackerrank solution in c++
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- system("pause") note working c++
- Category
- C++
- Title
- map vs unordered_map in C++
- Category
- C++
- Title
- how to take input in C++ in coding
- Category
- C++
- Title
- c++ append to list
- Category
- C++
- Title
- how to make string get spaces c++
- Category
- C++
- Title
- how to load from files C++
- Category
- C++
- Title
- c++ movment
- Category
- C++
- Title
- primitive and non primitive data types in c++
- Category
- C++
- Title
- double to int c++
- Category
- C++
- Title
- string substr c++
- Category
- C++
- Title
- RLE Encoding/Compression c++
- Category
- C++
- Title
- c++ program for addition of two numbers using functions
- Category
- C++
- Title
- user input c++
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- reverse a linked list using recursion
- Category
- C++
- Title
- git branch in my bash prompt
- Category
- C++
- Title
- bfs in C++
- Category
- C++
- Title
- Given an undirected graph, count the number of connected components.
- Category
- C++
- Title
- double max value c++
- Category
- C++
- Title
- restting a queue stl
- Category
- C++
- Title
- how to cout in c++
- Category
- C++
- Title
- c++ code to print hello world
- Category
- C++
- Title
- euler phi gfg
- Category
- C++
- Title
- how to iterate trough a vector in c++
- Category
- C++
- Title
- error: redefinition of ‘class Customer’
- Category
- C++
- Title
- c++ program to find gcd of 3 numbers
- Category
- C++
- Title
- c++ how to skip the last element of vector
- Category
- C++
- Title
- c++ allocate dynamic with initial values
- Category
- C++
- Title
- passing array to function in c++
- Category
- C++
- Title
- c++ for loop syntax
- Category
- C++
- Title
- c++ isalphanum
- Category
- C++
- Title
- simple timer arduino blynk library error
- Category
- C++
- Title
- how the theam are store in database
- Category
- C++
- Title
- how to find length of string in c++
- Category
- C++
- Title
- C++ and endl
- Category
- C++
- Title
- translate
- Category
- C++
- Title
- preorder traversal
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- class in c++
- Category
- C++
- Title
- struct c++
- Category
- C++
- Title
- rosrun actionlib_msgs genaction.py
- Category
- C++
- Title
- c++ string
- Category
- C++