From d04debeffb156bd335111cc809b0fa3dd3ac97ab Mon Sep 17 00:00:00 2001 From: Muhammed Sabah Date: Mon, 18 Oct 2021 00:07:27 +0530 Subject: [PATCH] chore(Java): add Catalan Numbers and Priority queue (#577) --- algorithms/Java/Maths/catalan-numbers.java | 39 ++++++++++++++++++++++ algorithms/Java/README.md | 3 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 algorithms/Java/Maths/catalan-numbers.java diff --git a/algorithms/Java/Maths/catalan-numbers.java b/algorithms/Java/Maths/catalan-numbers.java new file mode 100644 index 00000000..e433689e --- /dev/null +++ b/algorithms/Java/Maths/catalan-numbers.java @@ -0,0 +1,39 @@ +// Program to print Catalan Numbers till n using recursive approach. + +import java.util.*; + +class CatalanNumbers{ + + public static int findCat(int n){ + + int val = 0; + + if (n<=1) return 1; + + for (int i=0;i