diff --git a/Assignment10/bin/MotzkinNumber.class b/Assignment10/bin/MotzkinNumber.class new file mode 100644 index 0000000..4eb83d9 Binary files /dev/null and b/Assignment10/bin/MotzkinNumber.class differ diff --git a/Assignment10/src/MotzkinNumber.java b/Assignment10/src/MotzkinNumber.java new file mode 100644 index 0000000..ab3d3e7 --- /dev/null +++ b/Assignment10/src/MotzkinNumber.java @@ -0,0 +1,16 @@ + +public class MotzkinNumber { + + public static void main(String[] args) { + for(int i=0;i<=20;i++)System.out.format("%d:%d\n",i,M(i)); + + } + public static int M(int n) { + if(n==0 || n==1) + return 1; + int temp = 0; + for(int i = 0;i<=n-2;i++)temp+=M(i)*M(n-2-i); + return M(n-1)+temp; + } + +}