# Tag Archives: catalan

## Number of Binary Trees for given Preorder Sequence lengthOctober 14, 2017

Count the number of Binary Tree possible for a given Preorder Sequence length n. Input : n = 1 Output : 1 Input : n… Read More »

## Non-crossing lines to connect points in a circleSeptember 14, 2016

Consider a circle with n points on circumference of it where n is even. Count number of ways we can connect these points such that… Read More »

## Dyck pathMarch 10, 2016

Consider a n x n grid with indexes of top left corner as (0, 0). Dyck path is a staircase walk from bottom left, i.e.,… Read More »

## Applications of Catalan NumbersFebruary 28, 2016

Background : Catalan numbers are defined using below formula: Catalan numbers can also be defined using following recursive formula. The first few Catalan numbers for… Read More »

## Find all possible binary trees with given Inorder TraversalDecember 21, 2015

Given an array that represents Inorder Traversal, find all possible Binary Trees with the given Inorder traversal and print their preorder traversals.

## Succinct Encoding of Binary TreeOctober 25, 2015

A succinct encoding of Binary Tree takes close to minimum possible space. The number of structurally different binary trees on n nodes is n’th Catalan… Read More »

## Construct all possible BSTs for keys 1 to NJuly 17, 2015

In this article, first count of possible BST (Binary Search Trees)s is discussed, then construction of all possible BSTs. How many structurally unique BSTs for… Read More »

## Find the number of valid parentheses expressions of given lengthAugust 26, 2014

Given a number n find the number of valid parentheses expressions of that length.

## Program for nth Catalan NumberMay 11, 2014

Catalan numbers are a sequence of natural numbers that occurs in many interesting counting problems like following.

## G-Fact 9July 16, 2010

The number of structurally different Binary Trees with n nodes is Catalan number Cn = (2n)!/(n+1)!*n!

## Total number of possible Binary Search Trees with n keysMay 26, 2010

Total number of possible Binary Search Trees with n different keys = Catalan number Cn = (2n)!/(n+1)!*n!